WCF response time, throttling - c#
My WCF service configuration:
<system.net>
<connectionManagement>
<add address ="*" maxconnection="500"/>
</connectionManagement>
</system.net>
<bindings>
<basicHttpBinding>
<binding name="customBasicHttpBinding"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
transferMode="StreamedResponse">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<security mode="None"/>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="customWebBinding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<security mode="None">
</security>
</binding>
</webHttpBinding>
</bindings>
<serviceBehaviors>
<behavior name="soapBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceThrottling maxConcurrentCalls="100"
maxConcurrentInstances="100" maxConcurrentSessions="100" />
</behavior>
</serviceBehaviors>
<services>
<service behaviorConfiguration="soapBehavior" name="Service.Service">
<endpoint name="soap"
address=""
binding="basicHttpBinding" bindingConfiguration="customBasicHttpBinding"
contract="ServiceModel.IService"/>
<endpoint
address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
As you can see I set up throttling parameter to handle 100 concurrent instances.
For a test purpose I created dummy method on my interface that looks something like this
[OperationContract]
string Test(){
return "test response time";
}
When I'm trying to call this method, it uses 100 parallel request ats once response time is very bad:
Now running 100 parallel requests...
ResponseTimes: 0,45205P, 10,047P, 0,43304P, 0,86609P, 1,33913P, 0,91409P, 1,34713P, 1,75718P, 1,37414P, 1,80718P, 1,80618P, 2,22622P, 2,64426P, 2,22822P, 2,62626P, 2,68127P, 3,0453P, 3,10731P, 3,47635P, 3,51035P, 3,91039P, 3,94039P, 3,9544P, 4,36844P, 4,34943P, 4,78748P, 4,37144P, 4,82248P, 4,79048P, 5,25052P, 4,81948P, 5,67657P, 5,25253P, 5,71657P, 5,67357P, 6,13761P, 5,70257P, 6,56566P, 6,12361P, 7,0117P, 6,53065P, 7,43674P, 6,9517P, 7,86679P, 7,36974P, 7,81778P, 8,29483P, 8,75988P, 8,71587P, 8,24182P, 8,70187P, 9,16392P, 9,12991P, 9,19492P, 9,57596P, 9,65797P, 10,08201P, 10,45205P, 10,52505P, 10,48905P, 10,9521P, 10,89709P, 11,37714P, 11,81118P, 11,32413P, 11,76418P, 11,83918P, 12,18222P, 12,31723P, 12,60526P, 12,75128P, 13,0423P, 13,17132P, 13,48935P, 13,64836P, 13,91039P, 14,07141P, 14,32843P, 14,48945P, 14,78548P, 14,91149P, 15,20652P, 15,33153P, 15,62856P, 15,75558P, 16,0516P, 16,19262P, 16,48265P, 16,61866P, 16,91169P, 17,05471P, 17,33773P, 17,48375P, 17,74677P, 17,92079P, 18,15782P, 18,34183P, 18,58086P, 18,77388P, 19,0069P,
0 request(s) failed.
Average response time:9,20126
Why are results so bad, I tried to change AppPool Worker Process count but no luck, can anyone tell what I'm missing, what is setting limits?
I'm using WCF 4.0, IIS7.5 on a Windows Server 2008R2 machine.
Thank you
It is difficult to provide much insight regarding communication performance issues without detailed information about the service, configuration and environment. At the least, you may way to provide the service binding, the ServiceBehaviorAttribute and information about the client configuration.
From years of conducting WCF performance testing and optimization, we have seen “similar” issues as you described … despite having 100 concurrent connections, the service does not seem to “respond” efficiently, even though the server resources do not seem busy. In our case, the “delay” was associated with a slow, “cold” startup and the time taken by the .NET thread pool to allocate threads.
The following article discusses our issue:
http://blogs.msdn.com/b/dmetzgar/archive/2011/05/04/wcf-scales-up-slowly-with-bursts-of-work.aspx
Good luck.
I just finished a big, industrial scale WCF project that employed throttling and found that throttling doesn't always yield the results you expect. We set up our WCF web servce on a production-grade virtual server, then we created a test harness that emulated 1000+ virtual clients on a multi-threaded program. Once we were ready, we ran, and re-ran, tests over and over using a bunch of different throttling settings from 1 - 1000, but were surprised by the results.
For instance, you'd think that running your web service with 200 max concurrent connections would be twice as fast as 100 max connections, but that's not what we found for settings for things like:
-max concurrent sessions
-max concurrent calls
-max concurrent instances
In reality, there wasn't much of a performance (callsProcessed/second) difference between MaxConcurrentSessions=10 and MaxConcurrentSessions=1000. The calls processed per second was about the same, only the memory usage was different. Same thing with other throttle settings.
The fastest setting we found for throttling? No setting at all; basically, let the System.ServiceModel library handle everything. That's the fastest that we found after days of testing.
As far as your performance is concerned, what I would do is try and figure out where the bottle necks are. For instance, if your WCF service is using SQL to retrieve data, try eliminating SQL and just return a static dataset and see if your time dramatically improves. If it does, then maybe you need to work on the database side of things. If it doesn't, maybe there's a problem processing your SOAP messages.
Related
Chart doesn't display long-running WCF service? Timeout issue?
We have a WCF method that generates a json for an amcharts chart. The chart then displays the data. If the call is made for a short period (ie. 12/1-12/5) then the json is produced quickly and the amcharts chart shows the data. On the other hand, if the call is made for all year, then the results will take longer to generate. Calling the WCF directly will generate the json in about 6-8 seconds. If the chart calls it, it never loads. I've already confirmed that the issue isn't the WCF method since a json is eventually returned. I understand that the SP can be optimized, but that's another issue. We use IIS 6 on Windows Server 2008. The application pool for this particular WCF is set at .Net Framework 4.0 and Integrated. In terms of the project, we use VS2013 and C#. What do you recommend? I tried increasing the timeout setting in web.config, but it didn't help much.
Please try to configure all the related properties. <bindings> <basicHttpBinding> <binding name="myBindingConfig" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" bypassProxyOnLocal="true" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:15:00" receiveTimeout="00:10:00" > <readerQuotas maxArrayLength="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" maxDepth="2147483647" maxBytesPerRead="2147483647" /> <security mode="None" /> </binding> </basicHttpBinding> </bindings> And servicebehavior, enable service debug to see the error in client <serviceBehaviors> <behavior name="myServiceBehavior"> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors>
WCF Service returns Error when invoking method from client after changing from http to https "ContractFilter mismatch at the EndpointDispatcher"
I created a HTTP wcf service that will be consumed by a windows client and utilized. I had no issue until I was using HTTP. Now my customer wants to change the site to HTTPS. So for development purpose I have used IIS express certificate and setup the service. Now my service is up and running in IIS with iisexpress self signed certificate. I am able to browse my new https service via browser as well as wcf test client tool. But when I try invoke the method from my windows application to new https wcf service. My service instance is created but only during invoking a method I get following error: System.ServiceModel.ActionNotSupportedException was unhandled by user code HResult=-2146233087 Message=The message with Action 'http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None). In service my binding config (config 3 is being used at https mode and config 2 was used during http mode) are as follows: <bindings> <wsHttpBinding> <binding name="wsHttpBinding_IPGPService"> <!--config test 1 - start --> <!--<security mode="None"> <transport clientCredentialType="None" /> <message establishSecurityContext="false" /> </security>--> <!--config test 1 - end --> <!--config test 2 - start --> <!--<security mode="None" /> <reliableSession enabled="true" />--> <!--config test 2 - end --> <!--config test 3 - start --> <!--<security mode="Transport"> <transport clientCredentialType="None" proxyCredentialType="None"/> <message clientCredentialType="Certificate" algorithmSuite="Default" /> </security>--> <security mode="Transport"> <transport clientCredentialType="None"/> </security> <!--config test 3 - end --> </binding> </wsHttpBinding> </bindings> <services> <service name="PGPService.PGPService"> <endpoint address="" binding="wsHttpBinding" contract="PGPService.IPGPService" bindingConfiguration="wsHttpBinding_IPGPService" /> <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> </service> </services> <serviceBehaviors> <behavior> <!-- To avoid disclosing metadata information, set the values below to false before deployment --> <!--<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="false"/>--> <!--test config - start--> <serviceDebug includeExceptionDetailInFaults="True" /> <!--test config - end--> </behavior> </serviceBehaviors> </behaviors> <protocolMapping> <add binding="basicHttpsBinding" scheme="https" /> </protocolMapping> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> In client we use custom binding to create service instance. url = "https://localhost:550/TestService/TestService.svc"; customBinding = new CustomBinding(); customBinding.Elements.Add(new ReliableSessionBindingElement()); customBinding.Elements.Add(new HttpsTransportBindingElement()); EndpointAddress endpointAdress = new EndpointAddress(url); pgpServiceClientInstance = new PGPServiceClient(customBinding, endpointAdress); pgpServiceClientInstance.ClientCredentials.ClientCertificate.SetCertificate( StoreLocation.CurrentUser, StoreName.Root, X509FindType.FindByThumbprint, "03815c894b62dcf2d17336ade2d9ca61ddb7f92c"); After adding service reference the app.config generated on my Windows application is as follows: <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IPGPService"> <security mode="Transport"> <transport clientCredentialType="None" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="https://localhost:550/TestService/TestService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPGPService" contract="PGPServiceReference.IPGPService" name="WSHttpBinding_IPGPService" /> </client> So now I can see my service instance is getting successfully created. but on the time of invoking a method I get above error. There is no code changed before and after moving to https on service end. It is the same service code. It was completely working fine on http but is broken on https. I have completely removed the service reference and added it newly after making my wcf service https. IIS express self signed certificate is installed and available already on my system. Both service and client are running in same system as of now since it is development I am suspecting I am having a configuration problem....but with less experience I could not figure out.
Actually it was an additional binding during service instantiation that was causing the problem. Got it sorted by commenting below line in instantiation part. url = "https://localhost:550/TestService/TestService.svc"; customBinding = new CustomBinding(); //customBinding.Elements.Add(new ReliableSessionBindingElement()); customBinding.Elements.Add(new HttpsTransportBindingElement()); This helped me to proceed with developing the entire service and client. So that concludes my fix for above issue. Further down the lane since i am a newbie to wcf service i faced following problems which i faced and solved. Someone who is struggling like me can use below step if you are facing my errors Next my service had problems accessing folder Fix: add seperate application pool with an service or administrator account with enough privileges. To add wcf session to existing code. Fix: This is where i am facing problem because i was using wshttpbinding with transport security. Then after browsing several materials and codes understood i have to make my config to custombinding with reliablesession and httpstransport to proceed further with development. so my config roughly appears as <customBinding abc of wcf> <reliableSession/> <httpsTransport/> <\customBinding> And also uncommented above line of service instantiation after understanding its real purpose.No need for any values in reliable session tag and httpsTransport for basic support of security. This solved my second issue. However i am facing wsdl import error in wcf client test tool now which i am struggling now to solve. svcutil proxy generation option or add service refrence with uncheked assembly option doesnt seem to be working. Also i noticed that even if add my service refrence freshly to client there is no configurations generated to my app.config file surprisingly.....and above mentioned options dont help.....looking for experts ideas.... Fix : ??? Expolring.... Souls who read this are welcome to give answer/suggestion.
Configuring WCF endpoint to enable both WebScript and Sessions
In fear of asking a question which has already been saturated on Stack Overflow, I have been scrolling through possible solutions and am none the wiser as how to achieve what I want to achieve, if it is indeed possible, or whether I have designed my system incorrectly. This question is not just about finding a solution, but to explain some of WCF’s complexities (and misunderstandings) when configuring/customising different endpoints. A Typical Scenario: A web-based checkout system where the customer can alter attributes such as qty or size of the product within their basket via making javascript calls back to the server. The server has to be aware of who the user is, so having a session available seems an ideal solution. WCF definitely seems the way to go, as this scenario can be extended at a future date to support another end-point, such as a mobile app or other service. (Outside the scope of my question, but verifying that I would like to use WCF against a legacy .Net Web Service) My problem with the above is configuring the endpoints / bindings. webHttpBinding – This is used so that web scripts can access the service (ie Javascript from a webpage). However it does not support sessions wsHttpBinding – This supports sessions but not web scripts. I've played around with various configurations. It seems that I need a combination of the above bindings, or maybe to create a custom binding which supports these elements? If so, are there any nice resources on how to do so? I've tried creating a custom binding and failed miserably! I've read various comments on other questions that suggest you shouldn't use Sessions via web scripts, that WCF doesn't support it, or that the system being implemented has been incorrectly designed. Firstly, WebServices support this so I find it hard to believe that WCF doesn't, especially as it supports both webscripts and sessions individually (but not together? Out the box maybe...). If I were to use something other than sessions, it would have to be a token based system so that the user can be identified, but surely this is effectively what a session is? I can build this, but it seems like recreating the wheel. Here is the configuration within my Web.Config. I have setup 3 endpoints to play with; one basic, one supporting sessions and the other supporting webscripts. (The address for the webHttpBinding endpoint is blank, as the service returns an error when in debug mode – I’ve seen this stated by several people too) <system.serviceModel> <behaviors> <endpointBehaviors> <behavior name="CustomerServiceAspNetAjaxBehavior"> <enableWebScript /> <!--<webHttp />--> </behavior> <behavior name="WebScript"> <enableWebScript /> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior name="serviceBehavior"> <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" /> <serviceMetadata httpGetEnabled="true" /> </behavior> <behavior name=""> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> <services> <service behaviorConfiguration="serviceBehavior" name="CustomerService"> <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="basicBinding" contract="CustomerService" /> <endpoint address="ws" binding="wsHttpBinding" bindingConfiguration="wsConfig" contract="CustomerService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="" behaviorConfiguration="CustomerServiceAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webConfig" contract="CustomerService" /> </service> </services> <bindings> <basicHttpBinding> <binding name="basicBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="None"></security> <readerQuotas maxStringContentLength="2147483647 "/> </binding> </basicHttpBinding> <wsHttpBinding> <binding name="wsConfig" transactionFlow="true"> <security mode="None" /> <reliableSession enabled="true" ordered="true"/> </binding> </wsHttpBinding> <webHttpBinding> <binding name="webConfig"> <security mode="None" /> </binding> </webHttpBinding> </bindings> <client/> </system.serviceModel> And this is my service interface, showing that I have set the SessionMode to Allow, and GetSession() which returns the current session id, or null if sessions are unavailable. using System.ServiceModel; using System.ServiceModel.Activation; using System.ServiceModel.Web; [ServiceContract(Namespace = "", ConfigurationName = "CustomerService", SessionMode = SessionMode.Allowed)] public interface ICustomerService { [OperationContract()] [WebGet()] bool UpdateBasketItem(int index, int productId, int qty, int attribSize); [OperationContract()] [WebGet()] string GetSession(); } So my long winded question is this.. Can I configure an endpoint to have webscript enabled so that I can access the service via javascript, and also sessions enabled at the same time? I have tested the endpoints individually via the WCF Test Client to see that the 'ws' endpoint does have sessions, and that the blank endpoint using webHttpBinding does not have sessions but is callable from Javascript. I understand that there may not be an 'out of the box' binding for this, so do I need to create a custom binding, or can I somehow morph the above two endpoints by using a sprinkle of configuration magic?
If you are looking for a service technology that can easily be accessed through JavaScript I would strongly consider Asp.Net WEB API instead. It's a great framework form creating web apis. It's much more accessible than wcf from a client side perspective and you can leverage standard asp.net concepts. Cookies, Session, Cache etc. I believe web api was even created in response to the difficulty of doing this in wcf. I would only consider wcf if you need SOAP support.
EndpointNotFoundException on call to operation of running RESTful WCF service
I have a really strange problem with one of my WCF services. I'm pretty sure that most people who have experimented with WCF services have had an EndpointNotFoundException thrown when an endpoint had not been set up correctly in one of their configuration files. From the EndpointNotFoundException class page on MSDN: The exception that is thrown when a remote endpoint could not be found or reached. Further on, it continues: The endpoint may not be found or reachable because the remote endpoint is down, the remote endpoint is unreachable, or because the remote network is unreachable. This does not reflect my situation. So it seems that receiving an EndpointNotFoundException when working with WCF is not unusual, but this Exception is not thrown when first trying to access the service... instead, it is thrown only when trying to call one of the operations of the service: using (ExportConfirmationServiceClient client = new ExportConfirmationServiceClient( "WebHttpBinding_IExportConfirmationService")) // <-- Exception is NOT thrown here { ... component releaseConfirmation = DeserializeTestXmlFile(filePath); client.AddExportConfirmation("5051275066302", releaseConfirmation); // Exception is thrown on call to service operation on line above ... } Interestingly, the Exception message also includes the name of the operation in the mentioned file path: There was no endpoint listening at http://domain/Folder/ServiceName.svc/OperationName that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The inner Exception has the following message: The remote server returned an error: (404) Not Found. This is particularly confusing for me as I can successfully browse to the service URL and see the default You have created a service page: Also, if I navigate to the path in the Exception message, I see an Endpoint not found message on the page: However, if I navigate to any operation page of one of my other, working WCF services, I get a standard 400 Bad Request error from the browser, even though the operation works fine. So it would seem to me as if this original EndpointNotFoundException could be a red herring... I'm really not sure though, as I've not spent much time working with WCF. I'll show my web.config (server side) here just in case anyone needs to see it: <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="Midas.WebConfirmations.ExportConfirmationServiceBehaviour"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="webHttp"> <webHttp /> </behavior> </endpointBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="false" /> <services> <service name="Midas.WebConfirmations.ExportConfirmationService" behaviorConfiguration="Midas.WebConfirmations.ExportConfirmationServiceBehaviour"> <endpoint address="" binding="webHttpBinding" contract="Midas.WebConfirmations.IExportConfirmationService" behaviorConfiguration="webHttp" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration> This is the client App.config (bear in mind that this references two WCF services): <?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IDataService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> <webHttpBinding> <binding name="WebHttpBinding_IExportConfirmationService" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000"> <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/> </binding> </webHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="Midas.WebConfirmations.ExportConfirmationServiceBehaviour"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="webEndpointBehavior"> <webHttp defaultBodyStyle="Wrapped" defaultOutgoingResponseFormat="Xml" helpEnabled="true"/> </behavior> </endpointBehaviors> </behaviors> <client> <endpoint address="http://devbucket.ministryofsound.mos.local/MidasWebServices/DataService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDataService" contract="Midas.WebServiceClients.IDataService" name="BasicHttpBinding_IDataService" /> <endpoint address="http://devbucket.ministryofsound.mos.local/MidasWebConfirmations/ExportConfirmationService.svc" binding="webHttpBinding" bindingConfiguration="WebHttpBinding_IExportConfirmationService" behaviorConfiguration="webEndpointBehavior" contract="IExportConfirmationService" name="WebHttpBinding_IExportConfirmationService" /> </client> </system.serviceModel> </configuration> So if any of the great minds that frequent Stack Overflow could shed some light on this problem for me, I'd greatly appreciate it. UPDATE >>> In response to the first few comments, I suspected that the problem could be caused by an Exception being thrown from the server side code, so I simplified the operation code dramatically... now all it does is this, but I still get the same error: public void AddExportConfirmation(string upc, component ingestionFeedback) { WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.OK; } Also, I did set up tracing, but it only worked on the client side, so it only told me what I already knew. I will have a look at the link you provided #BigDaddy, in case it shows how to set up tracing on the server side. In response to Tewr, I generated the service client using svcutil.exe, but I also tried adding a service reference and letting Visual Studio create the reference for me... both methods resulted in the same error. Also, I have been updating the service references all day, as I've been making changes. The includeExceptionDetailInFaults="true" setting didn't make any difference, but I'll try adding a dummy operation to the service and try to view it in the browser. UPDATE 2 >>> Ok, so I added a simple getter method to the service and updated the references all round like #Tewr suggested. This has just made me more confused... the method: [XmlSerializerFormat()] [OperationContract] [WebGet()] string GetString(); The implementation just returns a string and I see that value when I access the service in a web browser: However, I still get the same error from code, even when calling this same new operation... what does that mean? UPDATE 3 >>> After taking the advice from the comments, I set up a Service Trace on the service again... I still couldn't get the one working on the server, but on the client, it did output a trace file. In that file, I see an InvalidOperationException with the following message: Envelope Version 'EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)' does not support adding Message Headers. I'm just researching this now, so if you know what this error is about, please let me know.
The problem with WCF is that it is so complex, the Exceptions cover so many different errors each and the Exception messages are so vague. From my limited experience, it seems like an error message will say one thing, but it will often be wholly, or partly irrelevant to your actual problem. So I basically kept fixing errors, which unlocked new Exceptions (and I still haven't come to the end of them yet!), but for the purpose of this question, there is an answer. So it turned out that the original EndpointNotFoundException was actually thrown because there was an unhandled Exception in the AddExportConfirmation service method implementation. Once I had simplified the code (as in the first question update), that particular Exception went away and was replaced with the next one.
Why callback from wcf service is so slow (especially the first time)
I have a service that sends several callbacks per second to connected clients. Why when the service sends a message do the clients get them a few or more seconds later? Here are the configuration details: <bindings> <wsDualHttpBinding> <binding name="WSDualHttpBinding_IMyService" receiveTimeout="00:30:00" sendTimeout="00:30:00" useDefaultWebProxy="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"/> </binding> </wsDualHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="Service1Behavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="True"/> <serviceThrottling maxConcurrentCalls="10" maxConcurrentInstances="10" maxConcurrentSessions="5" /> </behavior> </serviceBehaviors> </behaviors>
What you describe could be related to thread creation time. See here: WCF service may scale up slowly under load "Depending on the execution time and number of requests received you may notice the WCF execution time increase linearly by approximately 500ms for each request received until the process has created sufficient IOCP threads to service the requests or sustain the incoming load." A workaround is provided in the article.
I'm dealing with the same problem, looking at these links to address the issue. The overview seems that, out-of-the-box, WCF is 'locked down' to prevent DoS vulnerabilities. Essentially, you need to un-throttle the service as described in the links below. http://theburningmonk.com/2010/05/wcf-improve-performance-with-greater-concurrency/ http://blogs.msdn.com/b/wenlong/archive/2010/02/11/why-are-wcf-responses-slow-and-setminthreads-does-not-work.aspx http://weblogs.asp.net/sweinstein/archive/2009/01/03/creating-high-performance-wcf-services.aspx