开发者

Why IMetadataExchange is invisible?

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/MyVir开发者_StackOverflowtualFolder/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!


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..


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.


Finally I found out what was the reason:

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜