WCF向互联网用户开放

时间:2016-02-02 09:44:53

标签: asp.net windows wcf authentication iis

我在IIS上托管了一个WCF服务,这里是web配置。

<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IFactoryData" allowCookies="true" maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000" />
    <binding name="BasicHttpBinding_IWatheq">        
    </binding>
  </basicHttpBinding>
  <netTcpBinding>
    <binding name="NetTcpBinding_IFactoryData" />
  </netTcpBinding>
  <wsHttpBinding>
    <binding name="allowMax" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="200" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport clientCredentialType="None"></transport>
      </security>
        </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="http://eind.mci.gov.sa/FactoryWCF/FactoryData.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFactoryData" contract="MCI_FactoryData.IFactoryData" name="BasicHttpBinding_IFactoryData" />
  <endpoint address="https://wathiqprep.thiqah.sa/2.0/Wathiq.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWatheq" contract="WatheqServiceRef.IWatheq" name="BasicHttpBinding_IWatheq" />
  <!--<endpoint address="net.tcp://mci-inddb.mci.gov/FactoryWCF/FactoryData.svc"
    binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IFactoryData"
    contract="MCI_FactoryData.IFactoryData" name="NetTcpBinding_IFactoryData">
    <identity>
      <servicePrincipalName value="host/MCI-INDDB.MCI.GOV" />
    </identity>
  </endpoint>-->
</client>
<behaviors>
  <endpointBehaviors>
    <behavior name="Web" />
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="mex">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="mex" name="SIDFService.FactoryService">
    <endpoint behaviorConfiguration="Web" binding="wsHttpBinding" bindingConfiguration="allowMax" contract="SIDFService.IFactoryService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service behaviorConfiguration="mex" name="SIDFService.WatheqService">
    <endpoint behaviorConfiguration="Web" binding="wsHttpBinding" bindingConfiguration="allowMax" contract="SIDFService.IWatheqService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service behaviorConfiguration="mex" name="SIDFService.TempIndustrialLicenseService">
    <endpoint behaviorConfiguration="Web" binding="wsHttpBinding" bindingConfiguration="allowMax" contract="SIDFService.ITempIndustrialLicenseService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service behaviorConfiguration="mex" name="SIDFService.SaudiPostAddressService">
    <endpoint behaviorConfiguration="Web" binding="wsHttpBinding" bindingConfiguration="allowMax" contract="SIDFService.ISaudiPostAddressService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

IIS上的设置是匿名的,启用了Windows ...服务wsdl可以在域外访问,但在WCF测试客户端上它要求Windows凭据。在IIS身份验证时禁用Windows时,该服务会在域外的浏览器上显示错误。

0 个答案:

没有答案