IMetadataExchange 的合同属性无效 [英] Invalid contract attribute for IMetadataExchange

查看:18
本文介绍了IMetadataExchange 的合同属性无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 WCF 服务升级到 .NET Framework 4.5.这样做后,我注意到主机配置文件中的 IMetaDataExchange 周围有一条蓝色波浪线.

I have upgraded a WCF Service to .NET Framework 4.5. After doing so I noticed a blue squiggly line around the IMetaDataExchange in the host config file.

这是配置的服务部分的样子:

This is what the services section of the config looks like:

<services>
    <service behaviorConfiguration="MyBehavior" name="MyServiceHost">
        <endpoint binding="wsHttpBinding" bindingConfiguration="noSecurityBinding" contract="MyServiceContract"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>

当我将鼠标悬停在 IMetadataExchange 上时,错误显示:

When I hover the mouse over IMetadataExchange the error says:

'contract' 属性无效 - 根据其数据类型 'serviceContractType',值 'IMetadataExchange' 无效 - 枚举约束失败.

The 'contract' attribute is invalid - The value 'IMetadataExchange' is invalid according to its datatype 'serviceContractType' - The Enumeration constraint failed.

服务似乎运行良好.所以我很好奇为什么这是无效的.

The service seems to work fine. So I am curious why is this invalid.

推荐答案

你能在关闭 VS 后删除 .SUO(解决方案用户选项文件)文件吗?这将重置 VS 中 XMLEditor 组件的缓存并解决您的问题.

Can you delete .SUO (solution Users Option file) file after closing VS? This will reset the cache for XMLEditor component in VS and will fix your problem.

这篇关于IMetadataExchange 的合同属性无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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