你好我试图调用WCF服务在我的Windows应用程序消息无法在WCF来处理异常
我添加服务引用到我的项目,但在执行以下错误occures:
这很可能是因为动作 “http://tempuri.org/IUser/SaveUser”是不正确或者因为 消息包含令牌或 无效或过期的安全上下文因为绑定之间的不匹配。如果服务由于 处于非活动状态而导致服务中止,则安全上下文 令牌将无效。为了防止中止空闲会话 过早加大对服务端点的 结合的接收超时服务。
我试着增加服务端点绑定的接收超时。但是也有同样的例外。
这里是config file on client
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IUser" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:30:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:45:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://t2.ipixsolutions.net/Service.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IUser" contract="ServiceReference1.IUser"
name="WSHttpBinding_IUser">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
配置在服务器
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="WCFLibrary.Users">
<endpoint address="" binding="wsHttpBinding" contract="WCFLibrary.IUser">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- 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>
</system.serviceModel>
将绑定设置与服务器上的绑定设置进行比较。最有可能的是在那里有一个不匹配,正如错误也提到的那样。 –
或者更好,将它们发布到这里。 –
请您发表完整的例外。 –