Submit operation failed - NotFound from RIA Services with Silverlight 4 on SubmitChanges() - silverlight

I'm using SL4 and RIA Services to build a new solution based on the Silverlight Business Application template. Since I'm still developing, I'm just using localhost.
I'm trying to test the SubmitChanges functionality by making a single change in an associated (composition) entity and calling SubmitChanges. I have a breakpoint in my DomainService at the entry point in the Update method. The breakpoint is hit and everything looks okay. At this point, I don't actually have the Update method do anything - it simply returns. In the client-side callback, I check the SubmitOperation object for errors. It reports:
Submit operation failed. The remote server returned an error: NotFound.
So far I haven't found what wasn't found.
I tried using Fiddler (along with the WCF Binary plugin) and as far as I can tell, the request looks good, but according to Fiddler:
ReadResponse() failed: The server did not return a response for this request.
Hmm... Well that can't be right because my callback breakpoint was hit. (That's how I got the NotFound error message.)
I also tried editing my web.config file with the following:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="RIAServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
That didn't provide any new information. I'm starting to run out of ideas on how to track down the "real" problem. Any ideas??

Saurabh and Dan both have good posts on debugging 'Not Found' exceptions.
http://blogs.msdn.com/b/saurabh/archive/2010/03/16/ria-services-application-deployment.aspx
http://blogs.objectsharp.com/post/2010/04/13/WCF-RIA-Services-%E2%80%9CNot-Found%E2%80%9D-Error-Message.aspx
Kyle

Related

how to debug System.ServiceModel.FaultException in WCF?

I am new to this I can't seem to get meaningful (to me) debugging information. Is there a "best" or even "good" method to trace the error to this?
I have a client WPF application on my laptop that addresses a separate server running WCF hosted in IIS 7. The services on the server were added to the client project with "Add Service Reference". The service was then configured to provide asynchronous methods and updated on in the client.
When run, I keep getting:
System.ServiceModel.FaultException: The server was unable to process the request to an internal error. For more inforamtion about the error, either turn on IncludeExceptionDetailInFaults configuration behavior) on the server in order to sent the exception infomration back to the client, or turn on tracing as per the Microsoft .NET Frameowrk SDK documentation and inspect the .server trace logs.
I have been unable to trace this or keep missing the solution. (and really don't even know where the error is coming from).
Any ideas?
Here is the client app.config file (where I think the error is -- but I could be very wrong!):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_INovaDataService" />
<binding name="BasicHttpBinding_INovaDataService1" />
<binding name="BasicHttpBinding_INovaDataService2" />
</basicHttpBinding>
</bindings>
<client>
<endpoint name="MyLocalService"
address="http://localhost/NovaWebSite/Nova.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_INovaDataService"
contract="DataService.INovaDataService" />
<endpoint name="LibraryService"
address="http://192.168.1.100:43175/NovaWebSite/Nova.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_INovaDataService1"
contract="DataService.INovaDataService" />
<endpoint name="OfficeService"
address="http://10.0.11.100:43175/NovaWebSite/Nova.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_INovaDataService2"
contract="OfficeService.INovaDataService" />
</client>
</system.serviceModel>
I'm thinking there is probably a good/simple way to use the single
contract="DataService.INovaDataService"
but change the address endpoint in code (I know the DataService.INovaDataService contract does work correctly).
Any suggestions would sure be appreciated.

Load operation failed for query due to data limit

We have a silverlight application which interfaces with an RIA service to get a list of contacts to display in a grid, this normally works however we are getting the following error:
load operation failed for query x. the remote server returned an error: notfound
Tracing this through we have determined it is due to the amount of data that is being passed as it will work if the we pass roughly 3,800 records or less. We need to load at least 15,000 records from the database.
I have searched all over the internet to find a solution and have changed the following settings but nothing seems to have worked.
Settings changed are:
In IIS7 changed the ASP setting 'Response Buffering Limit' to 67108864
In IIS7 changed the ASP setting 'Maximum Requesting Entity Body Limit' to 2000000
In IIS7 changed the ASP setting 'Client Connection Test Interval' to 00:00:10
In our application web.config changed 'maxItemsInObjectGraph' to 2147483647
In our application web.config binding attributes 'maxReceivedMessageSize', 'maxBufferSize' and 'maxBufferPoolSize' are all set to 200000000
In our application web.config readerQuotas attributes 'maxArrayLength', 'maxStringContentLength', 'maxBytesPerRead', 'maxNameTableCharCount' are all set to 200000000
This is setup on Server 2008 R2 with IIS7 and using .Net 4.
This error also occurs when running in the debugger using the ASP.NET Development Server.
Any help would be appreciated.
Maybe your number of items is too limited in your Web.config, you can also enable detail in your faults like this to get more detail if this isn't the fix.
<services>
<service name="Service.Class.Full.Name"
behaviorConfiguration="Service_Behaviour_Name" />
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Service_Behaviour_Name">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="65536" />
</behavior>
</behaviors>
Service.Class.Full.Name needs to be you fully qualified service class name.
Service_Behaviour_Name can be anything, but the default looks like the full service class name with - rather than .

How can I configure a WCF service to accept a longer parameter list?

When calling a WCF service from Silverlight that works for smaller parameters, but fails for larger ones (with a "400:Bad Request" response), how can you configure the server to accept a larger number of parameters?
Long Version:
I am attempting to call a WCF service from Silverlight, and I am passing a List of Guids that contains 2000 Guids. The service call works for up to 1100 (exactly), but anything past that will result in an error. I looked at the response with Fiddler, and I am getting a response code 400 (Bad Request). I believe this to be a configurable parameter, but I am not sure what setting needs to be changed. I am not 100% confident that my config file settings are being applied as I am intending since I don't know how to check programmatically that these settings are being used. However, I have tried setting maxRequestLength, maxQuestyStringLength, and maxUrlLength of the httpRuntime element under system.web to extremely high values with no change. I have set maxReceivedMessageSize, maxBufferPoolSize, and maxBufferSize of the httpTransport element of a custom binding to high values with no effect. I have set maxDepth, maxArrayLength, maxBytesPerRead, maxNameTableCharCount, and maxStringContentLength of the readerQuota element of a basicHttpBinding also with no effect.
If it isn't obvious by now, I am taking random stabs in the dark based on recommendations from several places online, but nothing has had any effect. If someone knows conclusively which attribute I should be setting so that I can try again, I would greatly appreciate some knowledgable advice. Also it would be especially helpful if someone has advice about how I can check programmatically what settings are being used from my config file, that would at least allow me to confirm that the things I have already tried are being applied in the way I think they are.
UPDATE:
Looking at the situation a little closer, my problem is very similar to that described in
Large WCF web service request failing with (400) HTTP Bad Request.
I did not believe that to be the same issue because I set maxReceivedMessageSize as described in the solution and it didn't fix the problem. However, I think that my web.config is not being applied correctly because I just checked the size of the message in fiddler, and the last successful call (1100 Guids) causes the message size to be 65481, and the first failed request happens with message size 65540. That puts it just over the 65536 default limit.
Here is my current web.config serviceModel section:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" closeTimeout="01:00:00"
openTimeout="01:00:00" receiveTimeout="01:00:00"
sendTimeout="01:00:00" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ReportDataServiceBehavior"
name="DSTM.Reporting.ReportDataService">
<endpoint address="" binding="basicHttpBinding"
contract="DSTM.Reporting.IReportDataService" />
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ReportDataServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
How can I ensure that my service is using the binding that I am expecting?
You have binding="basicHttpBinding" in your endpoint declaration, which instructs the service to use the built-in WCF binding BasicHttpBinding. However, it will not use your customized binding unless you add bindingConfiguration="basicHttpBinding" to reference the specific binding that you have defined. You may also want to change the name of your <binding> to make it more clear that you are referencing your binding configuration, and not the basicHttpBinding itself.
Are you passing the parameters in the URL as the GET request or using POST request?
There is limitation in IIS for the length of the URL for GET request.
If that's the case, you can change the webmethod verb to accept POST instead.

Silverlight PollingDuplex InnerChannel faulted with multipleMessagesPerPoll (serverPollTimeout)

Im running silverlight client version 4.0.50917.0 and SDK version 4.0.50826.1
I've created a simple silverlight client against a wcf pollingduplex binding:
Web.config:
<system.serviceModel>
<extensions>
<bindingExtensions>
<add name="pollingDuplexHttpBinding"
type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="sv">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentSessions="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<!-- Create the polling duplex binding. -->
<pollingDuplexHttpBinding>
<binding name="multipleMessagesPerPollPollingDuplexHttpBinding"
duplexMode="MultipleMessagesPerPoll"
maxOutputDelay="00:00:01"/>
<binding name="singleMessagePerPollPollingDuplexHttpBinding"
maxOutputDelay="00:00:01"/>
</pollingDuplexHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="sv" name="Backend.GUIPollingService">
<endpoint address="" binding="pollingDuplexHttpBinding" bindingConfiguration="singleMessagePerPollPollingDuplexHttpBinding"
contract="Backend.IGUIPollingService" />
<endpoint address="mmpp" binding="pollingDuplexHttpBinding" bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
name="multimessage" contract="Backend.IGUIPollingService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
My silverlight client connect like this:
string endPointAddress2 = "http://"
+ App.Current.Host.Source.DnsSafeHost
+ ":"
+ App.Current.Host.Source.Port.ToString(CultureInfo.InvariantCulture)
+ "/GUIPollingService.svc/mmpp";
this.client = new GUIClientProxy.GUIPollingServiceClient(
new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll),
new EndpointAddress(endPointAddress2))
I got an eventhandler for innerchannel faulted:
client.InnerChannel.Faulted += new EventHandler(InnerChannel_Faulted);
...
void InnerChannel_Faulted(object sender, EventArgs e)
{
Dispatcher.BeginInvoke(() =>
{ status.Text += "Inner channel Faulted\n\n"
}
}
When using the above the Client.InnerChannelFaulted event happens exactly after one serverPollTimeout. (default 15seconds, verified with Fiddler)
If I switch my client to connect like this:
string endPointAddress2 = "http://"
+ App.Current.Host.Source.DnsSafeHost
+ ":"
+ App.Current.Host.Source.Port.ToString(CultureInfo.InvariantCulture)
+ "/GUIPollingService.svc";
this.client = new GUIClientProxy.GUIPollingServiceClient(
new PollingDuplexHttpBinding(),
new EndpointAddress(endPointAddress2))
aka single message per poll fiddler reveals that after each serverPollTimeout a new poll is started and the channel is not faulted.
Any ideas what's wrong here?
EDIT:
I have read http://social.msdn.microsoft.com/Forums/en/wcf/thread/1e6aa407-4446-4d4a-8dac-5392250814b8 and http://forums.silverlight.net/forums/p/200659/468206.aspx#468206
and I agree that "singleMessagePerPoll" is not a decent workaround. As you can see on my versions I am running the most recent versions of SDK and developer runtime.
EDIT2:
I just found out, that if I use google chrome as browser instead of IE8 MultipleMessagesPerPoll works fine! To me this smells like a runtime vs. ie8 bug?
EDIT3:
An confirmed on the silverlight WS blog:
Link
I confirm the issue on a sample, with the same SDK and client versions.
The issue has some more implications on other browsers too: I am under the impression that MultipleMessagePerPoll doesn't seem to work correctly on them neither (Fiddler and Firebug show something which looks a lot like SingleMessagePerPoll)
However I could make it work by using the client Network stack (bypassing the browser network stack). This solution is however far from perfect, as cookies must be set manually in this case. It can can be annoying or a non-issue depending on your application.
To perform all http request through the client stack, use this before you start your service calls:
HttpWebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
You could however be a little more specific, according to your needs.
If someone has a more satisfying answer, I would be glad to read it. If you are interested in reproducing the probleme, I have modified an old Tomek sample to use MultipleMessagePerPoll on SL4 instead of SingleMessagePerPoll on SL3.
This problem can be caused by adding global.asax to the hosting web site. Adding sessions to the hosting site apparently screws up the wcf polling duplex service. I struggled with this issue for several days and by merely deleting the global.asax file from the host web site the hang in the service went away. The multiplemessagesperpoll was a false lead. It works fine.
See this for more:
How can a newly added global.asax file make a mess of my WCF service

Webservice(s) become unresponsive when multiple clients are connected using polling duplex binding

I have a duplex enabled service where clients register themselves to receive notifications.
In the same AppPool I have another, regular web service which is used by the clients to communicate with the server. Sending something to this web service will trigger a notification to all connected clients.
All works fine until 12, 13 or more clients are connected. Then both subscribing/receiving with the duplex channel and sending something to the other service becomes much slower.
I have disabled asp.net compatibility and I don't have a global.asax file in my web service project that could trigger sessions to slow it down.
My web services are hosted in IIS7 on Windows Server 2008.
Please note that my clients run SL4 but the Webservices are hosted in .NET 3.5.
Here a few excerpts from my web.config file:
<bindingExtensions>
<add name="pollingDuplexHttpBinding" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </bindingExtensions>
<pollingDuplexHttpBinding>
<binding name="pollingDuplexHttpBindingConfig"/>
</pollingDuplexHttpBinding>
<service name="WcfDuplexService.NotificationService"
behaviorConfiguration="ServiceBehavior">
<!-- Service Endpoints -->
<endpoint address=""
binding="pollingDuplexHttpBinding"
bindingConfiguration="pollingDuplexHttpBindingConfig"
contract="WcfDuplexService.INotificationService"
behaviorConfiguration="ServiceFullEndpointBehavior">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
<!-- Message Service -->
<service name="WcfDuplexService.MessageService"
behaviorConfiguration="ServiceBehavior">
<endpoint binding="customBinding"
bindingNamespace="http://csintra.net/MessageService"
contract="WcfDuplexService.IMessageService"
bindingConfiguration="binaryHttpBinding"
behaviorConfiguration="ServiceFullEndpointBehavior">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceThrottling maxConcurrentCalls="1024" maxConcurrentSessions="1024" maxConcurrentInstances="1024" />
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
Thanks in advance.
we had the same issue time ago.
all things seems fine what you just described, except your configurations. you did not specify inactivity time out, open / closed time outs in your binding configuration for service. please set them accordingly. you can check the msdn for what works with you.
try only one instance at a time of service. but with multiple concurrency model. after load test we found it better approach in our case.
Load test of your duplex service, do check out performance counters during load test, to see whats going on on your server, is the RAM/ processor having trouble. Is the IIS worker process being halted? Please do check out these things.
you can Google about performance counter.
Enable WCF Tracing!!! May be there are some problems inside which are not being pop out.
Implement your custom tracing in your application to see whats going on. (optional but was very helpful in our case.)
Revist your architecture/ design of your Duplex service.
read the guidelines of WCF duplex service Performance guidelines on msdn. (very helpful)
Make your service multi threaded model enabled if you are setting the concurrency mode = multi and instance = 1.
Regards,
Mazhar Karimi

Resources