Call failed. Error: An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected.

Hi All,
I am trying to add a new task to a Tasks list called CATasks. The list was created via Visual Studio “Add > New Item > List” process and not by custom code. The code I am using to add a task is shown below.
What I have noticed is if I use my code to add a Task to a Task List created by Visual studio “Add > New Item > List” process, I get an error. Error message when adding an item:
Call failed. Error: An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected.
But if I create the same list using custom code I don't get an error.
Am I missing something in my custom code or is this a bug?
I hope you can help.
CEStar
App.js Code:
function createItem() {
var call = jQuery.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/?$select=Title,CurrentUser/Id&$expand=CurrentUser/Id",
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=verbose"
call.done(function (data, textStatus, jqXHR) {
var userId = data.d.CurrentUser.Id;
addItem(userId);
call.fail(function (jqXHR, textStatus, errorThrown) {
failHandler(jqXHR, textStatus, errorThrown);
function addItem(userId) {
var due =
new Date();
due.setDate(due.getDate() + 7);
var call = jQuery.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/getByTitle('CATasks')/Items",
type: "POST",
data: JSON.stringify({
"__metadata": { type:
"SP.Data.CATasksListItem" },
Title: "Sample Task",
AssignedToId: userId,
DueDate: due
headers: {
Accept: "application/json;odata=verbose",
"Content-Type":
"application/json;odata=verbose",
"X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
call.done(function (data, textStatus, jqXHR) {
var div = jQuery("#message");
div.text("Item added");
call.fail(function (jqXHR, textStatus, errorThrown) {
failHandler(jqXHR, textStatus, errorThrown);
function failHandler(jqXHR, textStatus, errorThrown) {
var response = JSON.parse(jqXHR.responseText);
var message = response ? response.error.message.value : textStatus;
alert("Call failed. Error: " + message);
Create List Custom Code:
function createList() {
var call = jQuery.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists",
type: "POST",
data: JSON.stringify({
"__metadata": { type:
"SP.List" },
BaseTemplate: SP.ListTemplateType.tasks,
Title: "CATasks"
headers: {
Accept: "application/json;odata=verbose",
"Content-Type":
"application/json;odata=verbose",
"X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
call.done(function (data, textStatus, jqXHR) {
var message = jQuery("#message");
message.text("List added");
call.fail(function (jqXHR, textStatus, errorThrown) {
var response = JSON.parse(jqXHR.responseText);
var message = response ? response.error.message.value : textStatus;
alert("Call failed. Error: " + message);

Hi,
I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
Thanks 
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Patrick Liang
TechNet Community Support

Similar Messages

  • Random Net connection call failed errors

    Hi All,
    I've built a Flex application which is calling coldfusion CFC through remote objects in order to retrieve data.
    2 days ago, I've updated the server with coldfusion 9 and my issue is that I have sometime those kind of error messages :
    [RPC Fault faultString="error" faultCode="Channel.Call.Failed" faultDetail="NetConnection.Call.Failed: HTTP: Failed"]
    [RPC Fault faultString="error" faultCode="Channel.Call.Failed" faultDetail="NetConnection.Call.Failed: HTTP: Status 503"]
    [RPC Fault faultString="error" faultCode="Channel.Call.Failed" faultDetail="NetConnection.Call.Failed: HTTP: Status 500"]
    [RPC Fault faultString="error" faultCode="Channel.Call.Failed" faultDetail="NetConnection.Call.Failed: HTTP: Status 504"]
    [RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://servername/flex2gateway/'"]
    It was also happening on Coldfusion 8 and even on one other sever with another application.
    (but same logic  Flex -> remote Objects -> CFC -> sql2005).
    When we were still running CF8 I added this <add-no-cache-headers>false</add-no-cache-headers> to the service-config.xml file but with no success.
    I do not know if it's related to this but I also sometimes have this error message :
    [RPC Fault faultString="Channel disconnected" faultCode="Client.Error.DeliveryInDoubt" faultDetail="Channel disconnected before an acknowledgement was received"]
    Most if time the application is running fine, but I want to avoid this errors.
    For example yesterday I recieved +- 50 times the NetConnection.Call.Failed error and 20 times Channel disconnected error.
    Do not hesitate to ask if I need to post CF9 settings summary or something else.
    Thank you for your help.
    Aubry

    That's a pity, but thanks for the reply.
    Dik

  • Call failed error

    Recently my phone stopped being able to make toll free 800 calls, local and long distance work fine but when I tried to call my bank and other companies 800 numbers I get a call failed error , not sure if it is my phone scewing up or what but I used to be able to call toll free numbers and all of a sudden was not able to anymore. Any suggestions or tips

    Hi and Welcome to the Forums!
    Anytime random strange behaviors creep in, the first thing to do is a battery pop reboot. With power ON, remove the back cover and pull out the battery. Wait about a minute then replace the battery and cover. Power up and wait patiently through the long reboot -- ~5 minutes. See if things have returned to good operation. Like all computing devices, BB's suffer from memory leaks and such...with a hard reboot being the best cure.
    Best!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Sony BRAVIA Call failed error message

    I'm trying to use Skype on a Sony BRAVIA TV and with the CMU-BR100 camera installed. I cannot make a video or telephone call to another skype user. I get call failed error message for both video and telephone. Do I need to buy Skype credits to be able to use Skype ??

    Shorty wrote:
    Can anyone experiencing the 'call failed' issue comment on whether the problem occurs 100% of the time, or is it always within the first 10 minutes after powering on the TV?
    Sorry.... Maybe I'm a bit thick, but do you mean 1/ switch the TV on and try Skype after 10 minutes? Or 2/ Try Skype within the 10 minutes? I'm happy to help with research if I can, even though I don't even switch this TV on anymore!
    My issue is constant. I.E. I turn the power off at the socket, wait at least 10 seconds, turn on, start the TV and make a Skype call. That works..... ONCE. If I try to call a second contact, it gives the "call failed" message, without even waiting for any type of connection, or pausing for any timeout. If anyone tries to contact me, they get a "busy" message.
    To be honest, I've not tried leaving the TV on for a while before trying. If I've nothing better to do over the next few days, I'll try that. I'm not that interested in it anymore. In fact... I don't like to see that TV in my living room and don't even use it!
    Skype on my phone works better, with better video and sound quality. That's where I'm at.....
    Maybe I'm on a downer tonight...

  • The Remote Procedure call failed error in Microsoft Direct Access configuration

    Hi,
    I have setup the Microsoft Base lab using Microsoft TLG, I have generated the IPHTTPS and NLS server certificate using the Microsoft PKI. After that I have installed the Microsoft Direct Access role but at the time of configuring the Remote Access Server
    it fails with the remote procedure call failed error.
    Could anybody help me to resolve this issue. I have searched a lot but no any solution found. It will be very helpful, if some one can point me where I did mistake.
    Thanks,
    Arif

    sql server services give error the remote procedure call failed [0x800706be] in sql server 2008.
    To resolve this issue, I executed the following mofcomp command in command prompt to re-register the *.mof files:
    mofcomp.exe "C:\Program Files (x86)\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof".
    but it does not work.
    Plz give the exact soln to solve this error.
    So when you tried starting SQL server service it gave the error right  ?  or when you click on SQL server services in SQL server configuration manager(SSCM) you get this error. Can you be more clear.  As far as I read your question it has something
    to do with permission. Close SSCM window and this time  right click on SQL server configuration manager and select run as administrator and check if you can see SQL server services
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Articles

  • RFC call failed : Error when opening an RFC connection

    Hi,
    As a result of "Start Data Collection" operation in the t-code RZ70, I have got this error.
    "RFC call failed : Error when opening an RFC connection"
    Others things are with success message.
    Regards,
    Bala Raja

    hi
    check this links
    http://help.sap.com/saphelp_nw04s/helpdata/en/9b/da0f41026df223e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/9b/da0f41026df223e10000000a155106/frameset.htm
    also check Tcode: SLDAPICUST.
    run tcode SLDCHECK? any error?
    Thanks
    Rodrigo
    PS: If useful reward points

  • HT202159 I was downloading a app from the app store and it downloaded about 85% then gave an error message download failed but when I reopen the app store to the purchases the resume button show but when i click it the same error comes up failed to downlo

    I was downloading a app from the app store and it downloaded about 85% then gave an error message download failed but when I reopen the app store to the purchases the resume button show but when i click it the same error comes up failed to download

    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Select
    /var/log ▹ install.log
    from the hierarchical list on the left. If you don't see that list, select
    View ▹ Show Log List
    from the menu bar. Then select the messages from the last installation or update attempt, starting from the time when you initiated it. If you're not sure when that was, start over and note the time. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V).
    If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.

  • Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic. It was running the command 'Discover-ExchangeServer -UseWIA $true -SuppressError $true -CurrentV

    I installed Exchange Server 2010 inside my VMWare Windows Server 2008 Ent R2. And After successful installation  when I try to open my Exchange Server Console, I am getting the following error message. I am very new to Exchange server please help me
    to solve this problem.
    Initialization Failed
    The following error occurred while searching for the on-premises Exchange server:
    [win-.local] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic. It was running the command 'Discover-ExchangeServer -UseWIA $true -SuppressError
    $true -CurrentVersion 'Version 14.1 (Build 218.15)''.
    Thanks Vivek
    SharePoint Foundation 2010 Book
    http://www.redpipit.com

    Hi,
    Please have a look at the article below:
    Troubleshooting Exchange 2010 Management Tools startup issues
    http://blogs.technet.com/b/exchange/archive/2010/02/04/3409289.aspx
    Resolving WinRM errors and Exchange 2010 Management tools startup failures
    http://blogs.technet.com/b/exchange/archive/2010/12/07/3411644.aspx
    Besides, please run the cmdlet below:
     set-user alias -remotepowershellenabled$true
    Xiu Zhang
    TechNet Community Support

  • "Call Failed" error outside of home area code

    I have an iPhone 5 on verizon wireless running IOS 6.1, and everytime I make a call outside of my home area code I get the 'call failed" error.  I have Dial Assist turned on.  I get the same message with Dial Assist turned off.  I am syncing to my corporate Exchange directory if that makes any difference
    Anyone else run into this before?

    hi
    check this links
    http://help.sap.com/saphelp_nw04s/helpdata/en/9b/da0f41026df223e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/9b/da0f41026df223e10000000a155106/frameset.htm
    also check Tcode: SLDAPICUST.
    run tcode SLDCHECK? any error?
    Thanks
    Rodrigo
    PS: If useful reward points

  • "Call Fail" error when trying to make out calls.

    Hi, I'm on iPhone 4S with iOS 6.1.3 . Recently I've been experiencing this problem of doing  outgoing calls. It keeps on having this "CALL FAILED" error. Previously it sometimes came but went back normal after an hour and I thought It might be caused by my network carrier . But its been 4 days now. Do take note that Im still be able to receive all incoming calls, SMS, Apps Messaging as well internet surfing &amp; others. Pls guys help me to resolve this issue. Tq.
    P/S
    My location = Malaysia
    My ISP &amp; cellular network carrier = Celcom

    Hello zipinabag,
    Thank you for all the information you provided regarding the issue you are experiencing when making a call on the iPhone. I recommend reviewing this tutorial:
    Calls and connection issues
    http://www.apple.com/support/iphone/assistant/calls/
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Message failing in SXMB_moni----Error while reading from the secure store

    Hi,
    The scenario is as below
    A file is picked up from a folder and processed to enrich it.This enriched file is then written back in a different folder.
    The message is failing in sxmb_moni while trying to write the file in the folder.
    The PI system is a system copy of another system and few of the configuration objects are transported through a tpz file to this PI system.The file receiver channel used to write this file is also transported through this tpz file.
    Below is the error seen in moni.:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Call Adapter --> <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1"><SAP:Category>XIServer</SAP:Category><SAP:Code area="INTERNAL">AE_DETAILS_GET_ERROR</SAP:Code><SAP:P1/><SAP:P2/><SAP:P3/><SAP:P4/><SAP:AdditionalText>Error while reading from the secure store: ERROR_U: No service user password found for Adapter Engine</SAP:AdditionalText><SAP:Stack>Error while reading access data (URL, user, password) for the Adapter Engine
    </SAP:Stack><SAP:Retry>M</SAP:Retry></SAP:Error>
    Below is Trace log:
    <Trace level="1" type="B" name="PLSRV_CALL_ADAPTER"></Trace><!-- ************************************ -->
    <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV"></Trace><!-- ************************************ -->
    <Trace level="1" type="B" name="CL_XMS_MAIN-CALL_PLSRV_LOCAL"></Trace><!-- ************************************ -->
    <Trace level="1" type="B" name="CL_XMS_PLSRV_IE_ADAPTER-ENTER_PLSRV">
    <Trace level="1" type="B" name="CL_XMS_PLSRV_CALL_XMB-CALL_XMS_HTTP"></Trace><!-- ************************************ -->
    <Trace level="1" type="T">error reading secstore:Error while reading from the secure store: ERROR_UNKNOWN: System-dependent data for entry  changed:  / (SECSTORE,031) </Trace>
    <Trace level="1" type="System_Error">Error while reading access data (URL, user, password) for the Adapter Engine  </Trace>
    </Trace>
    </Trace>
    <Trace level="1" type="System_Error">Error exception return from pipeline processing! </Trace>
    <Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_TO_PERSIST"></Trace><!-- ************************************ -->
    Is this because  PI system is a system copy of another system ?
    Regards,
    Sneha

    Error while reading access data (URL, user, password) for the Adapter Engine
    Check out Michal's reply:
    Re: URL for Central Adapter Engine
    As you said there was a system copy it may be the case that some things were not configured properly

  • When I try to install Itunes, I get this error: (translated from Norwegian) There was a network error while trying to read from the file: C: \ windows \ installer \ iTunes.msi I have tried many times to reinstall, but nothing helps, please help me.

    When I try to install Itunes, I get this error: (translated from Norwegian) There was a network error while trying to read from the file: C: \ windows \ installer \ iTunes.msi I have tried many times to reinstall, but nothing helps, please help me.

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • My iphone froze last nite and i was unable to exit the app i was on, it then switched the screen off as if it was not in use, now i am unable to open my iphone or switch it off, calls are still comin thro as phone is vibrating but im unable to answer

    my iphone froze last nite and i was unable to exit the app i was on, it then switched the screen off as if it was not in use, now i am unable to open my iphone or switch it off, calls are still comin thro as phone is vibrating but im unable to answer as cant activate the screen?????
    pls help

    See Here for  >  Frozen or unresponsive iPhone
    Try this First...
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...
    http://support.apple.com/kb/ht1430
    More Info here...
    https://discussions.apple.com/message/19521062

  • I bought an app from the app store, it said there was an error downloading and it did not download but apple still took money off my apple account, how do i get my money back?

    I bought an app from the app store, it said there was an error downloading and it did not download but apple still took money off my apple account, how do i get my money back?

    From the App Store meny bar click Store > Check for Unfinished Downloads
    And check your Applications folder for the app.
    Apple's policy > All Sales Are Final >  iTUNES STORE - TERMS AND CONDITIONS
    Note... it would help to tell us which Mac OS X you have installed when you post for help.

  • TcpListener not working on Azure: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host

    Hi Everybody,
    i'm playing a little bit with Windows Azure and I'm blocked with a really simple issue (or maybe not).
    I've created a Cloud Service containing one simple Worker Role. I've configured an EndPoint in the WorkerRole configuration, which allows Input connections via tcp on port 10100.
    Here the ServiceDefinition.csdef file content:
    <?xml version="1.0" encoding="utf-8"?>
    <ServiceDefinition name="EmacCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-01.2.3">
    <WorkerRole name="TcpListenerWorkerRole" vmsize="Small">
    <Imports>
    <Import moduleName="Diagnostics" />
    <Import moduleName="RemoteAccess" />
    <Import moduleName="RemoteForwarder" />
    </Imports>
    <Endpoints>
    <InputEndpoint name="Endpoint1" protocol="tcp" port="10100" />
    </Endpoints>
    </WorkerRole>
    </ServiceDefinition>
    This WorkerRole is just creating a TcpListener object listening to the configured port (using the RoleEnvironment instance) and waits for an incoming connection. It receives a message and returns a hardcoded message (see code snippet below).
    namespace TcpListenerWorkerRole
    using System;
    using System.Net;
    using Microsoft.WindowsAzure.ServiceRuntime;
    using System.Net.Sockets;
    using System.Text;
    using Roche.Emac.Infrastructure;
    using System.IO;
    using System.Threading.Tasks;
    using Microsoft.WindowsAzure.Diagnostics;
    using System.Linq;
    public class WorkerRole : RoleEntryPoint
    public override void Run()
    // This is a sample worker implementation. Replace with your logic.
    LoggingProvider.Logger.Info("TcpListenerWorkerRole entry point called");
    TcpListener listener = null;
    try
    listener = new TcpListener(RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint1"].IPEndpoint);
    listener.ExclusiveAddressUse = false;
    listener.Start();
    LoggingProvider.Logger.Info(string.Format("TcpListener started at '{0}:{1}'", RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint1"].IPEndpoint.Address, RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint1"].IPEndpoint.Port));
    catch (SocketException ex)
    LoggingProvider.Logger.Exception("Unexpected exception while creating the TcpListener", ex);
    return;
    while (true)
    Task.Run(async () =>
    TcpClient client = await listener.AcceptTcpClientAsync();
    LoggingProvider.Logger.Info(string.Format("Client connected. Address='{0}'", client.Client.RemoteEndPoint.ToString()));
    NetworkStream networkStream = client.GetStream();
    StreamReader reader = new StreamReader(networkStream);
    StreamWriter writer = new StreamWriter(networkStream);
    writer.AutoFlush = true;
    string input = string.Empty;
    while (true)
    try
    char[] receivedChars = new char[client.ReceiveBufferSize];
    LoggingProvider.Logger.Info("Buffer size: " + client.ReceiveBufferSize);
    int readedChars = reader.Read(receivedChars, 0, client.ReceiveBufferSize);
    char[] validChars = new char[readedChars];
    Array.ConstrainedCopy(receivedChars, 0, validChars, 0, readedChars);
    input = new string(validChars);
    LoggingProvider.Logger.Info("This is what the host sent to you: " + input+". Readed chars=" + readedChars);
    try
    string orderResultFormat = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes("\xB")) + @"MSH|^~\&|Instrument|Laboratory|LIS|LIS Facility|20120427123212+0100||ORL^O34^ORL_O34| 11|P|2.5.1||||||UNICODE UTF-8|||LAB-28^IHE" + Environment.NewLine + "MSA|AA|10" + Environment.NewLine + @"PID|||patientId||""""||19700101|M" + Environment.NewLine + "SPM|1|sampleId&ROCHE||ORH^^HL70487|||||||P^^HL70369" + Environment.NewLine + "SAC|||sampleId" + Environment.NewLine + "ORC|OK|orderId|||SC||||20120427123212" + Encoding.ASCII.GetString(Encoding.ASCII.GetBytes("\x1c\x0d"));
    writer.Write(orderResultFormat);
    catch (Exception e)
    LoggingProvider.Logger.Exception("Unexpected exception while writting the response", e);
    client.Close();
    break;
    catch (Exception ex)
    LoggingProvider.Logger.Exception("Unexpected exception while Reading the request", ex);
    client.Close();
    break;
    }).Wait();
    public override bool OnStart()
    // Set the maximum number of concurrent connections
    ServicePointManager.DefaultConnectionLimit = 12;
    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString");
    RoleEnvironment.Changing += RoleEnvironment_Changing;
    return base.OnStart();
    private void RoleEnvironment_Changing(object sender, RoleEnvironmentChangingEventArgs e)
    // If a configuration setting is changing
    LoggingProvider.Logger.Info("RoleEnvironment is changing....");
    if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
    // Set e.Cancel to true to restart this role instance
    e.Cancel = true;
    As you can see, nothing special is being done. I've used the RoleEnvironment.CurrentRoleInstance.InstanceEndpoints to retrieve the current IPEndpoint.
    Running the Cloud Service in the Windows Azure Compute Emulator everything works fine, but when I deploy it in Azure, then I receive the following Exception:
    2014-08-06 14:55:23,816 [Role Start Thread] INFO EMAC Log - TcpListenerWorkerRole entry point called
    2014-08-06 14:55:24,145 [Role Start Thread] INFO EMAC Log - TcpListener started at '100.74.10.55:10100'
    2014-08-06 15:06:19,375 [9] INFO EMAC Log - Client connected. Address='196.3.50.254:51934'
    2014-08-06 15:06:19,375 [9] INFO EMAC Log - Buffer size: 65536
    2014-08-06 15:06:45,491 [9] FATAL EMAC Log - Unexpected exception while Reading the request
    System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    --- End of inner exception stack trace ---
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32 userOffset, Int32 desiredChars, Boolean& readToUserBuffer)
    at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)
    at TcpListenerWorkerRole.WorkerRole.<>c__DisplayClass0.<<Run>b__2>d__0.MoveNext() in C:\Work\Own projects\EMAC\AzureCloudEmac\TcpListenerWorkerRole\WorkerRole.cs:line 60
    I've already tried to configure an internal port in the ServiceDefinition.csdef file, but I get the same exception there.
    As you can see, the client can connect to the service (the log shows the message: Client connected with the address) but when it tries to read the bytes from the stream, it throws the exception.
    For me it seems like Azure is preventing the retrieval of the message. I've tried to disable the Firewall in the VM in Azure and the same continues happening.
    I'm using Windows Azure SDK 2.3
    Any help will be very very welcome!
    Thanks in advance!
    Javier
    En caso de que la respuesta te sirva, porfavor, márcala como válida
    Muchas gracias y suerte!
    Javier Jiménez Roda
    Blog: http://jimenezroda.wordpress.com

    hi Javier,
    I changed your code like this:
    private AutoResetEvent connectionWaitHandle = new AutoResetEvent(false);
    public override void Run()
    TcpListener listener = null;
    try
    listener = new TcpListener(
    RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint"].IPEndpoint);
    listener.ExclusiveAddressUse = false;
    listener.Start();
    catch (SocketException se)
    return;
    while (true)
    IAsyncResult result = listener.BeginAcceptTcpClient(HandleAsyncConnection, listener);
    connectionWaitHandle.WaitOne();
    The HandleAsync method is your "While (true)" code:
    private void HandleAsyncConnection(IAsyncResult result)
    TcpListener listener = (TcpListener)result.AsyncState;
    TcpClient client = listener.EndAcceptTcpClient(result);
    connectionWaitHandle.Set();
    NetworkStream netStream = client.GetStream();
    StreamReader reader = new StreamReader(netStream);
    StreamWriter writer = new StreamWriter(netStream);
    writer.AutoFlush = true;
    string input = string.Empty;
    try
    char[] receivedChars = new char[client.ReceiveBufferSize];
    // LoggingProvider.Logger.Info("Buffer size: " + client.ReceiveBufferSize);
    int readedChars = reader.Read(receivedChars, 0, client.ReceiveBufferSize);
    char[] validChars = new char[readedChars];
    Array.ConstrainedCopy(receivedChars, 0, validChars, 0, readedChars);
    input = new string(validChars);
    // LoggingProvider.Logger.Info("This is what the host sent to you: " + input + ". Readed chars=" + readedChars);
    try
    string orderResultFormat = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes("\xB")) + @"MSH|^~\&|Instrument|Laboratory|LIS|LIS Facility|20120427123212+0100||ORL^O34^ORL_O34| 11|P|2.5.1||||||UNICODE UTF-8|||LAB-28^IHE" + Environment.NewLine + "MSA|AA|10" + Environment.NewLine + @"PID|||patientId||""""||19700101|M" + Environment.NewLine + "SPM|1|sampleId&ROCHE||ORH^^HL70487|||||||P^^HL70369" + Environment.NewLine + "SAC|||sampleId" + Environment.NewLine + "ORC|OK|orderId|||SC||||20120427123212" + Encoding.ASCII.GetString(Encoding.ASCII.GetBytes("\x1c\x0d"));
    writer.Write(orderResultFormat);
    catch (Exception e)
    // LoggingProvider.Logger.Exception("Unexpected exception while writting the response", e);
    client.Close();
    catch (Exception ex)
    //LoggingProvider.Logger.Exception("Unexpected exception while Reading the request", ex);
    client.Close();
    Please try it. For this error message, I suggest you could refer to this thread (http://stackoverflow.com/questions/6173763/using-windows-azure-to-use-as-a-tcp-server
    ) and this post (http://stackoverflow.com/a/5420788).
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for