There is a webservice (that I don't control) that returns a large response. In a simple console application the call to the service returns of the expected data. However when I do the same in a web application, some of the data is missing.
If I serialize the response and write it to a file, one file is 215mb and the other 117mb (they should be the same size).
The web service bug occurs both on my local maching and on the production web server.
No errors are being thrown. I have run a WCF trace and is shows no errors or warnings. There is nothing logged in the event log.
The <system.serviceModel> config section is exactly the same between the two applications.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_Service" maxReceivedMessageSize="2147483647" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://myService/Service.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_Service" contract="MyService.Service"
name="WSHttpBinding_Service">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
There are several possibilities:
If the data was getting truncated you would have a malformed xml, which Would result in an exception.
If the web server was not using the correct config file and it did not allow the size of response you would get an exception.
In both of the above cases you would not be able to serialize the result.
So you are getting a wellformed xml back, but it is a different size. Then there are 2 possibilities:
A difference in the encoding, that affects the size
A difference in the request parameters, that affects what is returnned
Related
I am pretty new to WCF and I was hoping someone could point me in the right direction.
Basically, I am trying to pull information from an existing WCF which was not developed by me.
So, for testing purposes, I created a console application and added the svc as a service reference.
I create a new instance of the client, and whenever I try to execute any of the methods, I get the following error:
The HTTP request was forbidden with client authentication scheme 'Anonymous'.
Does this mean the WCF requires a signed certificate to authenticate the client?
If this is the case, do I need to request/provide anything from/to the WCF's provider?
I´ve looked through several post related to this issue, but all these scenarios are based on the assumption that you have access to the server.
EDIT
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="..." />
<binding name="SecureByTransport">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/Web/ConnectWcf.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ConnectBasic"
contract="ConnectBasic.IConnectBasic" name="BasicHttpBinding_IConnectBasic" />
<endpoint address="https://localhost/Web/ConnectBasicWcf.svc"
binding="basicHttpBinding" bindingConfiguration="SecureByTransport"
contract="ConnectBasic.IConnectBasic" name="SecureByTransport" />
</client>
</system.serviceModel>
</configuration>
After implemeting a WCF service, hosting it on the IIS Server, it returned with the below error.
EndpointNotFoundException was unhandled by user code There was no
endpoint listening at XXXXX that could accept the message. This is
often caused by an incorrect address or SOAP action. See
InnerException, if present, for more details.
That service is identically has the same implementation and configuration of 5 running services with no errors.
when I tried to figure out what is going on the IIS server, the below screenshot.
So it seems that this specific service has no detected Contract. although I'm using the same configuration as below.
<service name="XX.XX.Provisioning.EldaftarManagementService">
<endpoint address="" binding="customBinding" bindingConfiguration="ProvisioningServiceBinding" bindingNamespace="http://XX.XX.com/XX/" contract="XX.XX.Provisioning.Eldaftar.IEldaftarManagementService" />
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="ProvisioningBasicBinding" bindingNamespace="http://XX.XX.com/provisioning/" contract="XX.XX.Provisioning.Eldaftar.IEldaftarManagementService" />
</service>
<service name="XX.XX.Provisioning.Common.UserManagement.UserManagementService">
<endpoint address="" binding="customBinding" bindingConfiguration="ProvisioningServiceBinding" bindingNamespace="http://XX.XX.com/XX/" contract="XX.XX.Provisioning.Common.UserManagement.IUserManagementService" />
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="ProvisioningBasicBinding" bindingNamespace="http://XX.XX.com/provisioning/" contract="XX.XX.Provisioning.Common.UserManagement.IUserManagementService" />
</service>
Kindly noted that when accessing the service.svc url it replies normally and the wsdl is shown. So that means it's hosted fine on the IIS.
Do I miss something?
Update:
Client config.
<endpoint address="https://XXX/EldaftarManagementService.svc" behaviorConfiguration="ProvisioningClientBehaviour" binding="customBinding" bindingConfiguration="ProvisioningServiceBinding" contract="EldaftarManagementService.IEldaftarManagementService" />
<endpoint address="https://XXX/UserManagement.svc" behaviorConfiguration="ProvisioningClientBehaviour" binding="customBinding" bindingConfiguration="ProvisioningServiceBinding" contract="UserManagementService.IUserManagementService" />
i notice sometime after reconfigure my service reference, the client config getting wsdl with server name. then i get EndpointNotFoundException exception.
example :
service reference is : http://192.168.61.2:1111/Service1.svc
but in the config endpoint address it show : http://serverName:1111/Service1.svc
After i change the config endpoint address with the service reference address , then it resolved. Not sure why but now every time when i reconfigure the endpoint address, i will manually change the config endpoint address to make sure it get the same address.
I have to connect to a legacy web service.
In visual studio, if I do a Add Service Reference, then enter the url of the WSDL file on server. My service shows up, and I write the code against it. But when I run the code I get this error:
System.ServiceModel.CommunicationException: The envelope version of
the incoming message (Soap12
(http://www.w3.org/2003/05/soap-envelope)) does not match that of the
encoder (Soap11 (http://schemas.xmlsoap.org/soap/envelope/)). Make
sure the binding is configured with the same version as the expected
messages.
My app.config looks like this:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="LoginServiceSoap" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://server/Service.asmx" binding="basicHttpBinding"
bindingConfiguration="LoginServiceSoap" contract="Stuff.Login.LoginServiceSoap"
name="LoginServiceSoap" />
</client>
</system.serviceModel>
However, I am able to communicate with the service fine, if I add a 'Web Reference'. But my understanding is that I am supposed to use Service References now, instead of WebReferences. I am assuming I have something wrong in my above config.
Or am I forced to use a Web Reference, because of the type of service I am connecting to?
Sheamus,
You could (theoretically) add the version number to the binding definition.
envelopeVersion="None/Soap11/Soap12"
With, of course, the right value for your service.
So it would look more like:
<basicHttpBinding>
<binding name="LoginServiceSoap"
envelopeVersion="Soap12" />
</basicHttpBinding>
Hope this helps you do things your way.
I have a wcf service that works fine. The problem is the client. I have a little gui where the user is supposed to place the ip address of where the wcf service is located. Both the client and service are on the same network so if I am not able to connect it is because I provided an incorrect ip address or because the firewall is blocking. Anyways how can I shorten that time so that if the user types the incorrect ip he does not have to wait like 20 seconds? Here is how my app.config file looks for my client:
Here is how my client app.config file looks:
<client>
<endpoint address="net.tcp://127.0.0.1:41236/" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IService1" contract="ServiceReference1.IService1"
name="NetTcpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
Edit
I have updated my app.config file to:
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService1" sendTimeout="00:00:02" receiveTimeout="00:00:02">
<security mode="Transport" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://10.10.1.154:41236/"
binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IService1"
contract="ServiceReference1.IService1"
name="NetTcpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
note I am placing an ip address that does not exist on purpose and for some reason the program still waits for like 10 seconds... I added sendTimeout="00:00:02" receiveTimeout="00:00:02" attributes and still did not work :(
Edit 2
Here is the error message that I get:
Could not connect to net.tcp://10.10.1.154:41236/. The connection
attempt lasted for a time span of 00:00:21.0342031. TCP error code
10060: A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond 10.10.1.154:41236.
Note it attempted to connect for 21 seconds... I knew I was not going to be able to connect but it will be nice if I could reduce that time. I am planning to use this program on the same network...
On your NetTcpBinding_IService1 bindingConfiguration
add an attribute sendTimeout="00:00:02"
This will reduce it to 2 seconds.
Edit
Please use OpenTimeout="00:00:02" this should work.
replace timeout in your bindingConfiguration NetTcpBinding_IService1
An answer for this has been given here wcf-channelfactory-and-opentimeout. It has something to do with sockets timeout. It seems that a workaround is needed.
I have a problem transmitting a file-sized thingy through WCF which uses the named pipe binding
<netNamedPipeBinding>
<binding name="largeMessage"
maxBufferPoolSize="524288000"
maxReceivedMessageSize="655360000"
maxBufferSize="655360000" >
<readerQuotas maxStringContentLength="655360000"
maxArrayLength="2000001"
maxBytesPerRead="2000001"
maxNameTableCharCount="2000001" />
</binding>
</netNamedPipeBinding>
and this is the service definition
<service name="BusinessService.TaskService"
behaviorConfiguration="BusinessService.TaskServiceBehavior">
<endpoint
address=""
behaviorConfiguration="customEndPointBehavior"
binding="netNamedPipeBinding"
bindingConfiguration="largeMessage"
contract="BusinessServiceContracts.Services.ITaskService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
as can be seen, i've set quite large values for all quotas i've been able to find, and still, i get the "The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element." error in the WCF trace files.
I'm fresh out of ideas where to look next, so has anyone else run into the same or similar problem?
The client configuration was (more or less) the same, but the darn thing just wouldn't work.
But, after I opened the server .config with the WCF Configuration Editor, made no changes, and saved, it magically started working, so my guess is that I had some sort of tag mix-up in the file.
Sorry to bother you.
You probably have two configuration files: one from service implementation, and another for your client application; Can you please post both configurations?
Besides, please read this article: Making Sense of Transport Quotas
OK, you've posted the server-side configuration with the <services> node - look fine to me. How about the client-side configuration? You would have to have something in the <client> node as well - does that reference the same binding configuration as well?
Marc