当前位置: 代码迷 >> Web Service >> wcf查看mex地址报错解决思路
  详细解决方案

wcf查看mex地址报错解决思路

热度:262   发布时间:2013-01-01 14:04:18.0
wcf查看mex地址报错
要用到wcf了,看了下资料,在打开mex地址的时候显示400错误,不知道问题出在哪里,麻烦熟悉的朋友帮忙看看

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

  <system.web>
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="WcfService1.Service1">       
        <endpoint address="" binding="basicHttpBinding" contract="WcfService1.IService1" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>    
    
    
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <!-- 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>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
        <defaultDocument>
            <files>
                <add value="Service1.svc" />
            </files>
        </defaultDocument>
  </system.webServer>
  
</configuration>




http://localhost:8081/Service1.svc正常,http://localhost:8081/Service1.svc/mex就显示400错误

对WCF不熟悉,麻烦各位帮下忙,谢谢!
------解决方案--------------------
需要暴露mex终结点
具体方法如下:
http://www.cnblogs.com/mane/archive/2011/05/27/2059578.html
  相关解决方案