Error connecting to server from WCF client - HTTPS endpoint - works on local Dev, but not on server

LOG UPDATE:

  • More details added - WCF tracing is enabled.

Firstly, there is not much WCF experience, so apologize if this is an obvious mistake. I am writing a simple console application that needs to connect to a third-party SOAP web service. The vendor supplied WSDL is located here:

http://pastebin.com/LJurv0qA

I used this to create a Service Reference in Visual Studio 2010 (using .NET 4.0) to create automatically generated code. I also installed app.config for various configurations:

<?xml version="1.0"?> <configuration> <configSections> <section name="CompanyCustomConfig" type="Company.Common.CustomConfigSections.EncryptedSomethingQuiteStrangeCredentialsSection, Company.Common" /> <section name="CompanyMachineConfig" type="Company.Common.CustomConfigSections.MachineEnvironmentKeySection, Company.Common" /> </configSections> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="sessionMethodsSoap" receiveTimeout="00:10:00" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="Transport" /> </binding> <binding name="sessionMethodsSoap1" /> <binding name="recipientMethodsSoap"> <security mode="Transport"> <!--<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>--> </security> </binding> <!--<binding name="recipientMethodsSoap1" />--> </basicHttpBinding> </bindings> <client> <endpoint address="https:test.jsp" binding="basicHttpBinding" bindingConfiguration="sessionMethodsSoap" contract="Session.sessionMethodsSoap" name="sessionMethodsSoap" /> <endpoint address="https:test.jsp" binding="basicHttpBinding" bindingConfiguration="recipientMethodsSoap" contract="Recipient.recipientMethodsSoap" name="recipientMethodsSoap" /> </client> </system.serviceModel> <appSettings> <add key="SomethingQuiteStrangeActionsClientBaseUrlWL0280" value="http://localhost.fiddler:13298/api/ua"/> <add key="SomethingQuiteStrangeActionsContentTypeWL0280" value="application/json"/> <add key="SomethingQuiteStrangeActionsClientBaseUrlTesting" value="http://localhost:13298/api/SomethingQuiteStrangeactions"/> <add key="SomethingQuiteStrangeActionsContentTypeTesting" value="application/json"/> <add key="SomethingQuiteStrangeDetailsClientBaseUrlLocalDevelopment" value="http://localhost.fiddler:13298/api/detailsofsomething/> <add key="SomethingQuiteStrangeDetailsContentTypeLocalDevelopment" value="application/json"/> <add key="SomethingQuiteStrangeDetailsClientBaseUrlTesting" value="http://localhost:13298/api/SomethingQuiteStrangedetails"/> <add key="SomethingQuiteStrangeDetailsContentTypeTesting" value="application/json"/> <add key="LogFileDirectoryTesting" value="C"/> <add key="LogFileDirectoryLocalDevelopment" value="C:\LogFiles\CRM"/> </appSettings> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> <CompanyCustomConfig> <EncryptedSomethingQuiteStrangeCredentials> <EncryptedSomethingQuiteStrangeCredential service="ThingLocalDevelopment" SomethingQuiteStrangeName="un" password="pw"/> </EncryptedSomethingQuiteStrangeCredentials> </CompanyCustomConfig> <CompanyMachineConfig> <MachineEnvironmentKeys> <MachineEnvironmentKey name="DEV" environment="LocalDevelopment" /> <MachineEnvironmentKey name="SERVER" environment="Testing" /> </MachineEnvironmentKeys> </CompanyMachineConfig> </configuration> 

Now in my LocalDevelopment (i.e. my laptop) the client works fine, I can connect to the thirdparties service using my Logon () action. When I deploy my code to our testing server, the same code and configuratio, n throws the following exception:

Log file started: 11/18/2015 20:11:25 on a TESTSERVER machine ================================= =================================================== ==================================== Recorded / 2015 20:11:25 Message: The problem is in the client (Client .Logon ()) - message Problem - Message: An error occurred while executing the HTTP request test.jsp. This should be because the server certificate is not configured properly with HTTP.SYS in the case of HTTPS. It can also be caused by a security binding mismatch between the client and server. Stack trace:

Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException (WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
in the System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply (TimeSpan timeout) in the System.ServiceModel.Channels.RequestChannel.Request (message message, TimeSpan TimerRequest.ReportManager.Channel.Manager.Service.Channel.Channel.Channel.Channel.Channel.Channel.Channel.Request. , TimeSpan timeout) on System.ServiceModel.Channels.ServiceChannel.Call (String action, Boolean oneway, ProxyOperationRuntime operation, Object [] ins, Object [], TimeSpan timeout) in System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (IMethodCallMessage method Call, ProxyOperationRuntime) when System.ServiceModel.Channels.ServiceChannelProxy.Invoke (iMessage message)

Exception thrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (iMessage reqMsg, IMessage retMsg) in System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (MessageData & Int3232 Hata, type. CRM.AdobeCRMService.Session.sessionMethodsSoap.Logon (LogonRequest request) in Hachette.CRM.AdobeCRMService.AdobeClient.Logon () in C: \ My Documents \ Hachette.CRM \ Hachette.CRM.AdobeCRMService \ AdobeClient.cs: line 84other: System .Collections.ListDictionaryInternal

Following the commentator’s recommendation below, I turned on WCF tracing on the server where the error occurs. An exception is thrown after a message is sent on a channel

 Exception Type: System.Net.WebException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message: The underlying connection was closed: An unexpected error occurred on a send. Exception Type: System.IO.IOException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message: Received an unexpected EOF or 0 bytes from the transport stream. 

Here is an image for clarity:

enter image description here

Now, although we use HTTPS, the third party does not require certifcates - the Logon () action provides me a sessionId for use later, so I assume to use basicHttpBinding am I fine?

What you need to know:

  • Windows 8.1 is running in my local development window
  • On a test server Im using deployment, installed Windows Server2008 R2 Standard (installed SP1).
  • My client is a .NET 4.0 C # console application.
  • I tried the SOAP user interface on the server, which fails using the same WSDL - an exhausted request and an abandoned network, so it should be a WCF / .NET problem in the field.
  • Also, do I need to activate WCF activation for applications that use WCF, such as mine — with service links and automatically generated code? Ours is disabled because it caused the failure of other sites (requires Service Model 3.0.0.0):

enter image description here

+5
source share
2 answers

In the end, I needed .NET 4.5.1 installed on Windows Server 2008 R2. Even though I aimed at .NET 4.0. This fixed the problem and now works.

+1
source

Troubleshoot SSL issues. Some options:

0
source

Source: https://habr.com/ru/post/1236262/


All Articles