2016-05-10 3 views
0

Я получаю эту ошибку: An unhandled exception of type 'System.ServiceModel.CommunicationException'WCF ошибка при получении ответа HTTP

полный discripton ошибки:

An unhandled exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll

Additional information: An error occurred while receiving the HTTP response to http://localhost:8733/Design_Time_Addresses/SnUpdateService/Service1/ . This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

Когда в Clien я пытаюсь получить ответ с потоковыми данными

SnUpdateService.Service1Client SnService = new  SnUpdateService.Service1Client(); 
     SnUpdateService.UpdateFiles com = new SnUpdateService.UpdateFiles(); 
     com.Path = "C:\\temp"; 
     com.SearchType = 1; 
     com.Version = "20150101"; 
     SnUpdateService.UpdateFiles comReturn = new SnUpdateService.UpdateFiles(); 
     comReturn = SnService.GetUpdateFiles(com);//here error 

если нет данных о потоке, все работает нормально.

Что я делаю неправильно?

Это мой клиент конфигурации

<?xml version="1.0" encoding="utf-8" ?> 
    <configuration> 
     <startup> 
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 
     </startup> 
     <system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
      <binding name="BasicHttpBinding_IService1" maxBufferPoolSize="200000000" 
       maxReceivedMessageSize="200000000" /> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://localhost:8733/Design_Time_Addresses/SnUpdateService/Service1/" 
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" 
      contract="SnUpdateService.IService1" name="BasicHttpBinding_IService1" /> 
     </client> 
     </system.serviceModel> 
    </configuration> 

Это мой сервер WebConfig

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

    <appSettings> 
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> 
    </appSettings> 
    <system.web> 
    <compilation debug="true" /> 
    </system.web> 
    <!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. --> 
    <system.serviceModel> 
    <services> 
     <service name="SnUpdateService.Service1"> 
     <host> 
      <baseAddresses> 
      <add baseAddress = "http://localhost:8733/Design_Time_Addresses/SnUpdateService/Service1/" /> 
      </baseAddresses> 
     </host> 
     <!-- Service Endpoints --> 
     <!-- Unless fully qualified, address is relative to base address supplied above --> 
     <endpoint address="" binding="basicHttpBinding" contract="SnUpdateService.IService1"> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <!-- Metadata Endpoints --> 
     <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
     <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, 
      set the values below to false before deployment --> 
      <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" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

</configuration> 

ответ

0

Я думаю, что вам не хватает для определения связывания конфигурации BasicHttpBinding_IService1 в файле конфигурации клиента.

Кроме того, вы можете установить includeExceptionDetailInFaults = "False" в значение "true", чтобы получить более подробную трассировку стека. Это помогает вам отлаживать.

-2

У меня была такая же проблема некоторое время назад и разрешила ее, включив 32-разрядные приложения в пул приложений, где размещался мой сервис.

+0

Можете привести пример, показывающий ваш ответ? –

Смежные вопросы