Understanding httpGetEnabled and Mex binding

我只是一个虾纸丫 提交于 2020-01-23 01:43:08

问题


In a WCF service, I have removed the default Mex binding and I have set the httpGetEnabled attribute in the default service behaviour to false.

With this my understanding is that the service would not allow downloading of WSDL. However, the service's existing clients would work without trouble.

Now, when I browse to the .svc in Internet Explorer, it advices 3 things to help me see the structure of .svc file.

  1. Create a behaviour for the service.
  2. In the serviceMetadata element, create httpGetEnabled attribute and set it to true.
  3. Create a mex binding end point. i.e

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

Now let me come to my question.

When I just make the httpGetEnabled="true", I am able to download the WSDL. I can't see the significance of mex endpoint here.

What is the real significance of mex end point here? What is the need for creating a mex end point when just httpGetEnabled gives me option to download WSDL?


回答1:


The Mex endpoint only becomes significant if you want to use WS-MetadataExchange instead of WSDL to grab the service metadata. You can enable one or the other, or both.

AFAIK, svcutil.exe can use either WSDL or mex, so it's not as much worry there; but you might have clients that only support one or the other.



来源:https://stackoverflow.com/questions/4715982/understanding-httpgetenabled-and-mex-binding

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!