繁体   English   中英

我可以有两个端点的WCF应用程序吗? 一种带有Windows安全性,另一种没有?

[英]Can I have a WCF application that has two endpoints. One with Windows Security and one without?

我已经阅读了几篇帖子(在SO和MSDN上),这些帖子应该显示如何为WCF服务提供两个端点。 但是,我似乎无法使它正常工作。 我尝试了它们显示的内容,但仍然无法正常工作。

这是我现在所拥有的:

<system.serviceModel>
  <services>
    <service name="MyServiceProject.MyServiceClass">
      <endpoint address="MyService.svc"
                  binding="basicHttpBinding"
                  bindingName="normalBasicHttpBinding"
                  contract="MyContractsProject.IMyServiceClass" />

        <endpoint address="SecuredMyService.svc"
                  binding="basicHttpBinding"
                  bindingName="secureBasicHttpBinding"
                  contract="MyContractsProject.IMyServiceClass" />
    </service>
  </services>
  <bindings>
      <basicHttpBinding>
          <binding name="normalBasicHttpBinding" maxBufferSize="5242880"
                    maxBufferPoolSize="5242880"
                    maxReceivedMessageSize="5242880">
              <readerQuotas maxArrayLength="16384"
                            maxStringContentLength="5242880" />
          </binding>

        <binding name="secureBasicHttpBinding" maxBufferSize="5242880"
                    maxBufferPoolSize="5242880"
                    maxReceivedMessageSize="5242880">
          <security mode="Transport">
            <transport clientCredentialType="Windows" />
          </security>
          <readerQuotas maxArrayLength="16384"
                        maxStringContentLength="5242880" />
        </binding>
      </basicHttpBinding>
  </bindings>
  <behaviors>
      <serviceBehaviors>
          <behavior>
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
      </serviceBehaviors>
  </behaviors>
</system.serviceModel>

我尝试过的这种变化:

  • 取出安全
  • 第一个地址为空白,第二个地址为“安全”,然后转到http://MyNormalEndpoint/MyService.svc/secure (为空,WCF Storm无法连接)
  • 添加< Host>部分,该部分是对部署路径的硬参考。 (我不想这样做,因为我的服务必须部署到几个不同的位置。但是无论如何都无法正常工作)
  • 只有一个端点(安全的一个)
  • 使用两种不同的绑定类型(wsHttpBinding)。

这些都不起作用。

现在,对我的普通服务的呼叫返回了404。(所以我搞砸了)。 如果你想看到我原来的(工作)的配置可以发现在这里

谢谢你的帮助。

您确定地址格式正确吗

指定端点地址

暂无
暂无

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

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