WCF wsHttpBinding,会话模式和发现

时间:2013-09-18 13:53:20

标签: c# wcf discovery

我正在开发具有集成Windows身份验证的可发现WCF服务。 当它在basicHttpBinding上时它正常工作,但我需要使用会话。由于basicHttpBinding不支持它们,我查看了wsHttpBinding。 所以,我不得不将http更改为https,但现在没有发现:( 服务在浏览器和测试客户端中可见,但UdpDiscovery找不到它:(

我的web.config:

    <?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
  </appSettings>
  <system.web>
    <authentication mode="Windows"/>
    <authorization>
      <deny users="*"/>
    </authorization>
    <compilation targetFramework="4.5" debug="true"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="OMS_Behavior">
          <serviceAuthenticationManager authenticationSchemes="Anonymous"/>
          <serviceDiscovery>            
          </serviceDiscovery>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata  httpsGetEnabled="true" 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="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="endpointBehaviorConfiguration">
          <!-- Add scopes used to identify the service -->
          <endpointDiscovery enabled="True"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpBinding_IMetaService">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="Windows"/>
            <message clientCredentialType="Windows"/>
          </security>         
        </binding>
      </wsHttpBinding>
    </bindings>
    <protocolMapping>
      <add binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IMetaService" scheme="https"/>      
    </protocolMapping>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
      <serviceActivations>
        <add service="OMS.Service.MetaService" relativeAddress="~/OMS.Service.svc"/>
      </serviceActivations>
    </serviceHostingEnvironment>
    <services>
      <service behaviorConfiguration="OMS_Behavior" name="OMS.Service.MetaService">
        <endpoint address="~/OMS.Service.svc" behaviorConfiguration="endpointBehaviorConfiguration" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IMetaService" name="Main" contract="OMS.Service.IMetaService">

        </endpoint>
        <endpoint behaviorConfiguration="endpointBehaviorConfiguration" name="udpDiscovery" kind="udpDiscoveryEndpoint"/>


      </service>
    </services>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="false"/>
  </system.webServer>
</configuration>

在这种情况下我该怎么做?

0 个答案:

没有答案