简体   繁体   English

WCF endPointBehavior中的任何内容可以取消metaData公开吗?

[英]WCF anything in the endPointBehavior cancels the metaData exposure?

This is my web.config file: 这是我的web.config文件:

<bindings>
  <basicHttpBinding>
    <binding 
      name="ExtremeBinding" 
      maxBufferSize="12354000" 
      maxReceivedMessageSize="12354000" />
  </basicHttpBinding>
</bindings>

<services>
  <service name="WcfService3.Service1" behaviorConfiguration="myServiceBehaviour">
    <endpoint 
      address="" 
      binding="basicHttpBinding" 
      bindingConfiguration="ExtremeBinding"
      contract="WcfService3.IService1" 
      behaviorConfiguration="epBehavior"/>
  </service>
</services>

<behaviors>
  <endpointBehaviors>
    <behavior name="epBehavior">

    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="myServiceBehaviour">
      <!-- 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" />

If I keep it like this, and run the WCF Test Client, everything works fine. 如果我保持这种状态并运行WCF测试客户端,则一切正常。

But if I add anything to the endPoint Behavior, for example: 但是,如果我向“端点行为”添加任何内容,例如:

    <behavior name="epBehavior">
      <callbackDebug includeExceptionDetailInFaults="true"/>
    </behavior>

the WCF Test Client fails with the Error: WCF测试客户端失败,并显示以下错误:

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

It seems as though it doesn't matter what I put within the . 好像我放进里面没什么关系。 For example: 例如:

<behavior name="epBehavior">
    <webHttp/>
</behavior>

It's clear to me that I missing something fundamental, but I can't figure what it is. 对我来说很明显,我缺少一些基本知识,但我不知道它是什么。 Thank you very much. 非常感谢你。

I don't know the exact reason why this happens, but I think you can fix this by adding a serviceMetadata behavior: 我不知道发生这种情况的确切原因,但是我认为您可以通过添加serviceMetadata行为来解决此问题:

<behaviors>
 <serviceBehaviors>
  <behavior name="NewBehavior">
    <serviceMetadata httpsGetEnabled="true" 
     httpsGetUrl="https://myComputerName/myEndpoint" />
  </behavior>
 </serviceBehaviors>
</behaviors>

This is from: http://msdn.microsoft.com/en-us/library/ms731317.aspx 这是从: http : //msdn.microsoft.com/en-us/library/ms731317.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM