ContractFilter 不匹配错误 [英] ContractFilter mismatch error

查看:29
本文介绍了ContractFilter 不匹配错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 StackOverflow 和其他地方看到了几个关于这个错误的帖子,但是我一直无法解决我的问题.

I have seen several threads about this error on StackOverflow and elsewhere but, I have been unable to get a solution to my problem.

我有一个尝试调用 Web 服务方法的应用程序.当它调用一种方法(提供登录验证)时,它工作得很好.然后,当它调用另一个函数(与登录/会员无关)时,它会生成此错误:

I have an application that attempts to call out to a web service method. When it calls one method (that provides login validation) it works just fine. Then, when it calls another function (not login/membership related) it generates this error:

无法处理包含 Action 'http://tempuri.org/IMyAppData/GetSomeSpecialXML' 的消息在接收方,由于 EndpointDispatcher 处的 ContractFilter 不匹配.这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配.检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无).

The message with Action 'http://tempuri.org/IMyAppData/GetSomeSpecialXML' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

我重建并重新发布了 Web 服务,然后从客户端应用程序中删除了服务引用并重新创建了它们.我仍然收到错误.以下是来自客户端应用程序的 app.config 文件的相关 XML:

I have rebuilt and republished the web service, then deleted the Service References from the client application and recreated them. I still get the error. Here is the relevant XML from the app.config file of the client application:

    <system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IMyAppData" 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://legolas.vectorcsp.home/MyAppSyncService/MyAppData.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyAppData"
            contract="MyAppData.IMyAppData" name="BasicHttpBinding_IMyAppData" />
    </client>       
</system.serviceModel>

这里是来自 Web 服务的 web.config 文件的相关 XML:

and here is the relevant XML from the web.config file of the web service:

<behaviors>
  <serviceBehaviors>
<behavior name="MyAppDataSvc.MyAppDataBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />

这一切都发生在我的本地机器上.我只是想在客户端应用程序上进行开发.任何人都可以建议我可能会尝试发现问题所在.

This is all taking place on my local machine. I am just trying to do development on the client application. Can anyone suggest what I might try to discover what the problem is.

预先感谢您提供的任何建议.

Thanks in advance for any advice you can give.

更新:我做了更多的测试.我已将 Web 服务发布到开发服务器,而不是我的本地机器.我仍然遇到同样的错误.我已经通过了应用程序和web服务的配置文件,我找不到任何问题.我已经将新创建的 Web 服务的 web.config 文件与以前版本的 Web 服务的 web.config 文件进行了比较,我没有发现任何问题.我已经将桌面应用程序的 app.config 文件的相关部分与 Web 服务的现有客户端的 web.config 文件进行了比较,但我找不到任何差异.

Update: I have done more testing. I have published the web service to a development server, instead of my local machine. I still get the same error. I have been through the config files of the application and the web service, and I can't find any problems. I have compared the web.config file of the newly created web service to the web.config file of a previous version of the web service, and I don't see any problems. I have compared the relevant section of the desktop application's app.config file with a web.config file of an existing client of the web service, and I can't find any discrepancy there.

我已使用 Microsoft 服务配置编辑器在桌面应用程序和 Web 服务上启用跟踪.当我运行桌面应用程序并抛出错误时,Web 服务的目录或桌面应用程序的目录中都没有创建日志文件.

I have enabled tracing on the desktop application and the web service using Microsoft Service Configuration Editor. When I run the desktop app and the error is thrown, no log files are created in either the web service's directory or the desktop application's directory.

我对此完全停滞不前.有人有什么建议吗?

I am at a complete stand-still over this. DOES ANYONE HAVE ANY SUGGESTIONS?

谢谢.

推荐答案

我发现了问题.

在客户端应用程序的 app.config 文件中,端点地址与服务地址不匹配,如 configuration.svcinfo 中所列.因此,这两个文件指向 Web 服务的不同实例和不同版本.

In the client application's app.config file, the address of the endpoint did not match the address of the service, as listed in configuration.svcinfo. So, the two files were pointing to different instances, and different versions, of the web service.

这篇关于ContractFilter 不匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆