WCF服务:没有可以接受带有操作的消息的频道

时间:2012-05-08 23:07:59

标签: wcf

手头有问题,我收到了消息:

"There was no channel that could accept the message with action." 

在服务器端和

"The message could not be processed. This is most likely because the action." 

在客户端。

我从Windows服务调用我的WCF服务,并且我在服务器上的ISS中托管了我的WCF服务。

这一切在我的localhost上工作正常。我想我在配置中遗漏了一些东西。

我的Web.config看起来像这样:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
    <appSettings>
        <add key="FileTransferPath" value="c:\FileServer\"/>
    <add key="BackUpFileTransferPath" value="c:\BackedUpFiles\"/>
    <add key="DBPath" value="C:\ProjectsSVN\Acso.accdb"/>
    </appSettings>
  <system.serviceModel>
      <services>
          <service name="FileTransfer.FileTransfer">
              <endpoint address="" binding="wsHttpBinding" contract="FileTransfer.IFileTransfer">
                  <identity>
                      <dns value="localhost" />
                  </identity>
              </endpoint>
              <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
              <host>
                  <baseAddresses>
                      <add baseAddress="http://localhost:65051/FileTransfer/" />
                  </baseAddresses>
              </host>
          </service>
      </services>
      <behaviors>
          <serviceBehaviors>
              <behavior>
                  <!-- 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="False" />
              </behavior>
          </serviceBehaviors>
      </behaviors>

      <bindings>
      <basicHttpBinding>
        <binding name="WSHttpBinding_IFileTransfer"
          maxReceivedMessageSize="2147483647">
          <readerQuotas
            maxDepth="64"
            maxStringContentLength="2147483647"
            maxArrayLength="2147483647"
            maxBytesPerRead="4096"
            maxNameTableCharCount="16384"/>
        </binding>
      </basicHttpBinding>

    </bindings>
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

   <!--Turn on to log Trace-->
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\logs\FileTransferTraces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

</configuration>

我的App.config看起来像这样:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
  </configSections>
  <connectionStrings>
    <add name="cs"
      connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\ProjectsSVN\Acso.accdb;Persist Security Info=True"
      providerName="System.Data.OleDb" />
    <add name="csc"
      connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\ProjectsSVN\AcsoGPClient.accdb;Persist Security Info=True"
      providerName="System.Data.OleDb" />
  </connectionStrings>
  <appSettings>
    <add key="FromEmail" value="abc@igi.com.au"/>
    <add key="Subject" value="Your Password"/>
    <add key="DBPath" value="C:\Program Files\Default Company Name\GPWindowServiceSetup\AccersoGPClient.accdb"/>
  </appSettings>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService11" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://ws2008.igi.aus/AcsoService/Service1.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IService11" contract="AccersoService.IService1"
        name="BasicHttpBinding_IService11" />
    </client>
  </system.serviceModel>

</configuration>

1 个答案:

答案 0 :(得分:0)

尝试使客户端绑定定义<basicHttpBinding/>成为服务配置中相同定义的精确副本。