0
votes

I getting this error :An unhandled exception of type 'System.ServiceModel.CommunicationException'

full discripton of error:

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.

When in clien i am trying to get response with stream data

  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

if there is no stream data all work fine.

What i am doing wrong?

This my client config

<?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>

This my server 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>
2

2 Answers

1
votes

I think you are missing the definition for the binding configuration BasicHttpBinding_IService1 in client configuration file.

Also, you can set includeExceptionDetailInFaults="False" to "true" to get more detailed stack trace. Which helps you debug.

-2
votes

I had the same problem some time back and resolved it by enabling 32-Bit applications in the app pool where my service was hosted.