在 Web.Config 中启用 MEX [英] Enable MEX in a Web.Config

查看:31
本文介绍了在 Web.Config 中启用 MEX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在以下 Web 配置中启用/创建 MEX 端点,以便我可以从浏览器查看服务?

我从谷歌搜索中尝试了一些变体,但 VS 总是抱怨它.(不是有效的子元素等...)

<预><代码><配置><system.web><编译调试="true" targetFramework="4.0"/></system.web><system.serviceModel><serviceHostingEnvironment aspNetCompatibilityEnabled="true"/><服务><服务名称="MyApp.MyService" behaviorConfiguration="WebServiceBehavior"><endpoint address="" binding="webHttpBinding" contract="MyApp.IMyService" behaviorConfiguration="JsonBehavior"><身份><dns value="localhost"/></身份></端点></服务></服务><行为><端点行为><行为名称="JsonBehavior"><webHttp/></行为></endpointBehaviors></行为></system.serviceModel></配置>

干杯,康纳

解决方案

在 VS 中,转到工具 >WCF 服务配置编辑器.你可以打开你的 web.config 并在一个漂亮的 GUI 中修改你的 WCF 端点和绑定,它(不应该)生成 VS 会抱怨的 XML.

How do I enable/create a MEX endpoint in the below web config so I can view the service from my browser?

I have tried a few variation from googling but VS always complains about it. (not a valid child element etc...)

<configuration>
 <system.web>
  <compilation debug="true" targetFramework="4.0" />
  </system.web>
   <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <services>
     <service name="MyApp.MyService" behaviorConfiguration="WebServiceBehavior">
      <endpoint address="" binding="webHttpBinding" contract="MyApp.IMyService"       behaviorConfiguration="JsonBehavior">
        <identity>
          <dns value="localhost"/>
        </identity>
      </endpoint>
    </service>
   </services>
   <behaviors>
   <endpointBehaviors>
      <behavior name="JsonBehavior">
       <webHttp/>
     </behavior>
   </endpointBehaviors>
 </behaviors>
 </system.serviceModel>
 </configuration>

Cheers, Conor

解决方案

In VS, go Tools > WCF Service Configuration Editor. You can open your web.config and tinker with your WCF endpoints and bindings in a nice GUI that (shouldn't) generate XML that VS will complain about.

这篇关于在 Web.Config 中启用 MEX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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