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
Related
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.
Please, I have the following problem:
I'm trying to dynamically load a WCF RIA service (DDL and DAL for Silverlight app).
I have main application maintaining authorization, authentication and so on. The app is implemented using Prism libraries - highly modular, but unfortunately because of referencing the RIA service library tihgtly coupled, so it is impossible to switch modules depending on customers requirements without recompiling whole solution and causing trouble with autogenerated code. It is hosted in IIS (IIS Express).
What I'm trying to do is to remove the reference to custom module in the main Webpage app, load the module dynamically and create necesary endpoints.
My first approach was to define the service in Web.config:
<services>
<service name=PatientRegistry.PatientRegistryDomainService"
behaviorConfiguration="RIAServiceBehavior">
<endpoint address="" binding="wsHttpBinding"
contract="PatientRegistryDomainService" />
<endpoint address="/soap"
binding="basicHttpBinding"
contract="PatientRegistryDomainService" />
<endpoint address="/binary"
binding="customBinding"
bindingConfiguration="BinaryHttpBinding"
contract="PatientRegistryDomainService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RIAServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="BinaryHttpBinding">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
Trouble was, that because it wasn't referenced, the necesary assembly wasn't loaded.
Then I tried to load the assembly in code, get the DomainServiceType from list of exported types (_types) and use DomainServiceHost:
Type _svctype = null;
foreach (Type _T in _types)
{
if (IsSubclassOfRawGeneric(typeof(DomainService), _T))
{
_svctype = _T;
break;
}
}
DomainServiceHost host = new DomainServiceHost(_svctype /*, BaseUri*/);
host.Open();
This approach failed on the wery same trouble all my previous attempts on selfhosting RIA: AspNetCompatibilityModeAttribute:
This service requires ASP.NET compatibility and must be hosted in IIS. Either host the service in IIS with ASP.NET compatibility turned on in web.config or set the AspNetCompatibilityRequirementsAttribute.AspNetCompatibilityRequirementsMode property to a value other than Required.
I've tried to set the attribute on the domain service by adding
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
but it had no effect. I'm quite desperately googling for quite a long time, but to no success.
Could you please kick me in the right direction on how to load unreferenced RIA service server?
P.S. I'm on Silverlight 5, VS2010
Have you tried to include this in your web.config?
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
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.
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
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