Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverlight: Web Service Call JSON Error
    primarykey
    data
    text
    <p>OK, so I have no idea why this isn't working. I've found 4 different tutorials/examples of calling a JSON web service asynchronously within Silverlight, and all of them use the same format / logic as I am. On the line "using (streamCommunities = request.EndGetRequestStream(asyncResult))" it is throwing the error I attached at the bottom, an ArgumentException saying it doesn't like the asyncResult. Why is this if every other example I've found uses the same logic?</p> <pre><code> private void GetSource(object state) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(MyValidUri)); request.Method = "POST"; request.ContentType = "application/json"; request.BeginGetResponse(new AsyncCallback(ReadCommunityCallBack), request); } private void ReadCommunityCallBack(IAsyncResult asyncResult) { HttpWebRequest request = (HttpWebRequest)asyncResult.AsyncState; using (Stream outStream = request.EndGetRequestStream(asyncResult)) { // DO STUFF HERE } } </code></pre> <p>And the error is here:</p> <pre><code>System.ArgumentException was unhandled by user code Message=Value does not fall within the expected range. StackTrace: at System.Net.Browser.ClientHttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult) at cenTabbedFeed.MainPage.ReadCommunityCallBack(IAsyncResult asyncResult) at System.Net.Browser.ClientHttpWebRequest.&lt;&gt;c__DisplayClass1a.&lt;InvokeGetResponseCallback&gt;b__18(Object state2) at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() </code></pre> <p>Like I said, I've been scouring examples and trying to find an answer on MSDN and I'm stuck and frustrated.</p> <p>-Thanks in advance RJ</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload