如果我设置 HttpGetEnabled = false 会发生什么 [英] What happens if I set HttpGetEnabled = false

查看:21
本文介绍了如果我设置 HttpGetEnabled = false 会发生什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对元数据发布概念感到困惑.

I am confused with Metadata publish concept.

如果在我编写的 WCF 服务配置文件中:

If in a WCF Service config file I had written :

  <serviceMetadata httpGetEnabled="false"/>

不管是真是假.当我尝试使用添加服务引用..."在客户端应用程序中提供服务引用时,并单击发现",我可以检索服务参考.

No matter it is true or false. When I tried to give service reference in a client application using "Add Service Reference..." and clicked on "Discover", I am able to retrieve Service Reference.

但是当删除以下两行时:-

But when removed the following two lines: -

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

<serviceMetadata httpGetEnabled="false"/>

现在,当我尝试使用添加服务引用...."在客户端应用程序中提供引用时;并单击发现",我不能检索服务参考....

Now after that when I tried to give reference in a client application using "Add Service Reference...." and clicked on "Discover", I am NOT able to retrieve Service Reference....

现在谁能告诉我这到底是什么意思.为什么在将其设置为 False 后它仍然允许设置参考.以及为什么在删除这些行后不允许设置引用.

Now can anyone tell me what exactly it means. Why after setting it False it is still allowing to set reference. And why after removing those lines it is not allowing to set reference.

推荐答案

MEX 和 WSDL 是两种不同的方案,用于告诉潜在客户您的服务结构.因此,您可以选择以元数据交换格式"(MEX) 或网络服务描述语言" (WSDL) -- 后者可通过 HTTP(s) 访问.

MEX and WSDL are two different schemes to tell potential clients about the structure of your service. So you can choose to either make your service contracts public as "metadata exchance format" (MEX) or in the "web service description language" (WSDL) -- the latter being accessible via HTTP(s).

因此,为了生成代理,您需要元数据信息.当您删除 serviceMetadata 行时,您表示您没有提供 WSDL 格式的元数据.

Thus in order to generate proxies, you need meta data information. When you remove the serviceMetadata-line you say you are not providing meta data in WSDL format.

但是之前在 MEX 中发布元数据的那一行仍然处于活动状态,因此您可以从这些元数据生成代理.

But the line before, publishing your metadata in MEX, is still active, thus you can generate a proxy from those metadata.

很自然地,当您既不提供 WSDL 也不提供 MEX 格式的信息时,您将无法生成代理.

From those follows naturally that when you provide neither WSDL nor MEX formatted information, you cannot generate a proxy.

正如 Joel C 正确指出的那样,绑定是一个(n 几乎)正交概念.您是否允许客户端通过基本的 HTTP、ws HTTP、网络命名管道或水晶球与您交谈并不完全取决于您发布服务的方式.

As Joel C correctly pointed out, the bindings are a(n almost) orthogonal concept. Whether you allow clients to talk to you via basic HTTP, ws HTTP, net named pipes or crystal balls is quite not dependent on how you publish your services.

WCF 安全指导项目和/或 MS WCF 安全性的实践和模式" 可能会提供更深入的见解.

The WCF security guidance project and / or MS "practises and patterns" for WCF security might provide deeper insight.

这篇关于如果我设置 HttpGetEnabled = false 会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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