WCF相关 - System.ServiceModel.FaultException:无法处理消息

时间:2014-07-30 20:40:08

标签: vb.net wcf

这类似于:http://social.msdn.microsoft.com/Forums/vstudio/en-US/71c31684-1ce7-4fd9-bf24-674e6dc707bf/the-message-could-not-be-processed?forum=wcf

然而,我没有忘记像那个人那样的条目,但我仍然得到同样的错误。

我明白了:

System.ServiceModel.FaultException:无法处理消息。这很可能是因为行动' http://tempuri.org/IBackupServerService/DeleteBySpaceIdProcess'不正确或因为邮件包含无效或过期的安全上下文令牌,或者因为绑定之间存在不匹配。如果服务因不活动而中止通道,则安全上下文令牌将无效。要防止服务中止空闲会话,请过早增加服务端点绑定的接收超时。

注意:我从服务器上的控制台应用程序托管服务,然后从位于另一台服务器上的Web应用程序调用该服务。

我的客户端web.config文件如下所示:(注意:" IP地址"" userPrincipalName"这些都是虚构的。)

<!-- Specifies the version of WCF to use. -->
<system.serviceModel>
  <bindings>
    <wsHttpBinding>
      <binding name="WSHttpBinding_IBackupServerService"  >
        <security mode="None" />
      </binding>
    </wsHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://999.999.999.999:8000/Application/BackupServerServiceLibrary/BackupServerService/BackupServerService"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBackupServerService"
    contract="ServiceReference1.IBackupServerService" name="WSHttpBinding_IBackupServerService">
    <identity>
      <userPrincipalName value="AAAAA5-415-B\jbrown" />
    </identity>
  </endpoint>
  </client>
</system.serviceModel>

我的服务app.config如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
   </appSettings>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
     <services>
       <service name="BackupServerServiceLibrary.BackupServerService">
       <host>
         <baseAddresses>
           <add baseAddress = "/BackupServerServiceLibrary/BackupServerService/" />
         </baseAddresses>
       </host>
       <!-- Service Endpoints -->
       <endpoint address="" binding="wsHttpBinding"
        contract="BackupServerServiceLibrary.IBackupServerService"
        bindingConfiguration="NoSecurity">
       <!-- 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 -->
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
     </service>
   </services>
   <bindings>
     <wsHttpBinding>
       <binding name="NoSecurity">
         <security mode="None" />
       </binding>
     </wsHttpBinding>
   </bindings>   
   <behaviors>
     <serviceBehaviors>
       <behavior>
         <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
         <serviceDebug includeExceptionDetailInFaults="True" />
       </behavior>
     </serviceBehaviors>
   </behaviors>
  </system.serviceModel>
 </configuration>

有什么想法吗?

0 个答案:

没有答案