1

我在收到消息时遇到了问题:

"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 服务。

这一切在我的本地主机上运行良好。我想我在配置中遗漏了一些东西。

我的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>
4

1 回答 1

0

尝试使客户端绑定定义<basicHttpBinding/>与服务配置中的相同定义完全相同。

于 2012-05-09T07:41:28.937 回答