I'm somewhat new to WCF and a call to get a record is taking almost 20 seconds, even a local call during debug takes that time. It completes correctly but is so slow.
Client call:
var docImgSvc = new DocImagingService.DocImagingStatusServiceClient("WSHttpBinding_IDocImagingStatusService");
CurrentManifest = docImgSvc.GetManifest(manifestLookup); //<<---This takes 20 secs
if (CurrentManifest == null || CurrentManifest.ManifestId == 0)
Server routine:
public Manifest GetManifest(int manifestNumber)
{
var de = new DocumentImagingEntities(); //<<---Takes 20 secs before it gets here.
var manifest = de.Manifests.FirstOrDefault(m => m.ManifestId == manifestNumber);
return manifest;
}
Server config:
<system.serviceModel>
<services>
<service name="DocImagingServices.DocImagingStatusService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/DocImagingServices/DocImagingStatusService/"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="DocImagingServices.IDocImagingStatusService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
Client Config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IDocImagingStatusService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/DocImagingServices/DocImagingStatusService/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDocImagingStatusService"
contract="DocImagingService.IDocImagingStatusService" name="WSHttpBinding_IDocImagingStatusService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
Previously when I have seen that type of response time it has been due to the application pool settings.
There is a setting that allows you to load the user profile when running the application pool, this load time could match your 20 seconds.
See http://blogs.msdn.com/b/vijaysk/archive/2009/03/08/iis-7-tip-3-you-can-now-load-the-user-profile-of-the-application-pool-identity.aspx for a screen dump of how to set this value.
Related
I am new to StackOverflow so forgive me if I get this wrong. I am getting a bad request error when calling a wcf service. The method takes a Byte array as a parameter. It works on small files but not on files that are 80000 bytes in length. I have posted the web config files below.
This is in my web config file
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IFileService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:4199/FileService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IFileService" contract="ConStringServices.IFileService"
name="BasicHttpBinding_IFileService" />
</client>
This is in my service web config file
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicBinding" maxReceivedMessageSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyServiceBehavior" name="MyService">
<endpoint bindingConfiguration="basicBinding" address="" binding="basicHttpBinding" contract="ConStringTest.Services.IFileService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<!-- 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>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Update: This is the method that is called within the service. Like I said, it works with small files.
public Boolean UploadFile(Byte[] file, string filename)
{
FileStream stream = new FileStream("C:\\Temp\\" + filename, FileMode.Create, FileAccess.ReadWrite);
stream.Write(file, 0, file.Length);
stream.Close();
Console.WriteLine(file.Length);
return true;
}
What am I doing wrong? Any help would be greatly appreciated.
Update: I have amended the service config file as above but still no joy.
Update: It is fixed. I just had to make the service name the Fully Qualified Name with namespace. ie. ConStringTest.Services.FileService
The problem is with the config where you are putting the name. This is not an arbritary name but rather the name of the service class file. If its wrong the config will not be applied and will use the default config. Change MyService to be the fully qualified name of the service class..
<service behaviorConfiguration="MyServiceBehavior" name="ConStringTest.Services.FileService">
<endpoint bindingConfiguration="basicBinding" address="" binding="basicHttpBinding" contract="ConStringTest.Services.IFileService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
When trying to call a function on the WCF Service i getting the error:
There was no endpoint listening at http://XXXXXXXXXXX.xxx/Service1.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
My WCF Service Web.config
<system.serviceModel>
<services>
<service name="Service1" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint contract="IService1" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
WCF Client app.config
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="MetadataExchangeHttpBinding_IService1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://XXXXXXXXXXX.xxx/Service1.svc"
binding="wsHttpBinding" bindingConfiguration="MetadataExchangeHttpBinding_IService1"
contract="API.IService1" name="MetadataExchangeHttpBinding_IService1" />
</client>
</system.serviceModel>
I have tried many many settings and configurations but dont getting this to work... do anyone find anything you think i missed?
Edit: I am hosting the service on a IIS and using a Winform client
You seem to have confused with service endpoint and mex endpoint. They are separate endpoints.
Change your config on server to this:
<endpoint contract="IService1" binding="wsHttpBinding" address="" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
Then recreate proxy.
I have a WCF Service with only the xml configuration file and the .exe (so not the complete solution). Can i make existing endpoints secure with https?
If so, how can i do this and how can i connect to it with my client which will be on another pc in the network?
this will be my service xml config:
my binding:
<wsHttpBinding>
<binding
name="HighQuotaWSHttpBinding"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
bypassProxyOnLocal="true"
maxBufferPoolSize="2147483647"
useDefaultWebProxy="false"
maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
my endpoint:
<service
behaviorConfiguration="WebDataServiceBehaviour"
name="Humiq.Integral.WebDataService.Impl.ServiceLayer.WcfLibrary.WebDataService">
<endpoint
address="WebDataService"
binding="wsHttpBinding" bindingConfiguration="HighQuotaWSHttpBinding"
contract="Humiq.Integral.WebDataService.Intf.ServiceLayer.IWebDataService"
name="WebDataServiceHttpBinding">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange"
name="mexManagement" />
<host>
<baseAddresses>
<add baseAddress="http://mylocalip:9650/" />
<add baseAddress="https://mylocalip:9651/" />
</baseAddresses>
</host>
</service>
behaviour:
<behaviors>
<serviceBehaviors>
<!-- Behavior for WebserviceData interface -->
<behavior name="WebDataServiceBehaviour">
<!-- Set throttling of (concurrent) cals -->
<serviceThrottling
maxConcurrentCalls="100"
maxConcurrentSessions="100"
maxConcurrentInstances="100"/>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata 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="True" />
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
</behaviors>
And this is my client:
<bindings>
<wsHttpBinding>
<binding name="WebDataServiceHttpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://mylocalip:9651/WebDataService" binding="wsHttpBinding"
bindingConfiguration="WebDataServiceHttpBinding" contract="wcf1.IWebDataService"
name="WebDataServiceHttpBinding">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
you need to define the port to use ssl on windows.
it is done with the netsh command, you can read its help:
netsh http add sslcert ipport=0.0.0.0:8732 certhash=4745537760840034c3dea27f940a269b7d470114 appid={00112233-4455-6677-8899-AABBCCDDEEFF}
I have a WCF service hosted within a Windows service. The client that is connecting to it is on the same machine so I would expect it to take long to connect and definitely not timeout. For some reason when I start the client and it tries to connect to the service it times out. This only happens occasionally, but enough where it is annoying since the entire app relies on a good connection tot he service. What could cause a client on the same machine as the service time out when connecting? Here are the app.config files from the host and the client.
Here is the client config:
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IWCFService" closeTimeout="00:00:10"
openTimeout="00:00:10" receiveTimeout="00:10:00" sendTimeout="00:00:30"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8731/Design_Time_Addresses/WCF/WCFService/"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IWCFService"
contract="WCFService.IWCFService" name="WSDualHttpBinding_IWCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
And the service config:
<system.serviceModel>
<services>
<service name="WCF.WCFService" behaviorConfiguration="WCFBehavior">
<endpoint address="" binding="wsDualHttpBinding" contract="WCF.IWCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
address="mex"
binding="mexHttpBinding"
bindingConfiguration=""
contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/WCF/WCFService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCFBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
Is there anything I can do to make the client connect better and make the the connection more stable in general? Change the binding? Anything?
Try to add one more endpoint with "netNamedPipeBinding" that was originally designed for local calls.
I have a WCF Service that has these configuration settings. When I call it from a client application I still hit the dreaded, "Maximum number of items that can be serialized or deserialized in an object graph is '65536'" What's wrong with my configuration below?
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="LargeBuffer" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="TestWcfService.Service1">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="LargeBuffer" name="ServiceEndPoint"
contract="TestWcfService.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Yes I increased it on the client side to match. And it still hits that limit. My concern is that when it pulls the service reference back, it still sees 65536 as the default size so it never recognizes the larger amount. Any thoughts?
Here's my client side code:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="ServiceEndPoint" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm=""/>
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:61423/Service1.svc" binding="wsHttpBinding"
bindingConfiguration="ServiceEndPoint" contract="LucasImport.IService1"
name="ServiceEndPoint">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>