为什么 IMetadataExchange 不可见?

发布于 2024-11-18 16:22:15 字数 1101 浏览 0 评论 0原文

我创建了使用 IIS 6 (Windows XP) 托管的 WCF 服务:

<system.serviceModel>        
    <behaviors>
      <serviceBehaviors>
        <behavior name="myServiceBehaviors">          
          <serviceMetadata httpGetEnabled="true"/>          
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>    
    <services>
      <service name="Namespace.Class" behaviorConfiguration="myServiceBehaviors">                
        <endpoint  contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />        
      </service>      
    </services>        
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>      

我使用 Visual Studio 2010 创建了虚拟目录 (MyVirtualFolder),当我将浏览器指向“http://localhost/MyVirtualFolder/MyService.svc”时 我收到错误页面,告诉我我应该打开元数据交换接口,并说明如何执行此操作以及如何修改我的配置文件。我仔细检查了一下,我的配置等于 html 页面建议的配置。

为什么IMetaDataExchange接口不可用?

先感谢您!

I have created WCF Service that is hosted with IIS 6 (Windows XP):

<system.serviceModel>        
    <behaviors>
      <serviceBehaviors>
        <behavior name="myServiceBehaviors">          
          <serviceMetadata httpGetEnabled="true"/>          
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>    
    <services>
      <service name="Namespace.Class" behaviorConfiguration="myServiceBehaviors">                
        <endpoint  contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />        
      </service>      
    </services>        
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>      

I have created virtual directory (MyVirtualFolder) with Visual Studio 2010 and when I point browser to "http://localhost/MyVirtualFolder/MyService.svc"
I get error page that tells me that I should turn on interface for metadataExchange with instructions how to do that, how I shall modify my configuration file. I double checked that and my config is equal to one that was proposed by html page.

Why does IMetaDataExchange interface is unavailable?

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

作妖 2024-11-25 16:22:15

尝试使用 而不是
如果您在 IIS 中托管 Web 服务,则您将拥有一个 *.svc 文件。您不需要端点来获取元数据、删除端点,一切都会正常工作。

Try <serviceMetadata /> instead of <serviceMetadata httpGetEnabled="true"/>.
If you host a web service in IIS, you have an *.svc file. You don't need an endpoint to get metadata, delete the endpoints, and all will work fine..

苦妄 2024-11-25 16:22:15

从您的 IMetadataExchange 端点中删除 address="mex"

此外,您的服务本身没有实际的端点。

如果可能,请尝试使用 SvcConfigEditor,WCF 配置编辑器(Windows 的一部分) SDK)来获取工作服务和客户端配置。

Remove address="mex" from your IMetadataExchange endpoint.

Also there's no actual endpoint for your service itself.

If possible, try using SvcConfigEditor, the WCF configuration editor (part of Windows SDK) to get a working service and client configuration.

晒暮凉 2024-11-25 16:22:15

最后我找到了原因:

指向错误的类:(

Finally I found out what was the reason:

<service name="Namespace.Class"> pointed to wrong class :(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文