環境: Windows Server 2008 R2
1.伺服器的"驗證"必須將Windows驗證開啟,並關閉匿名驗證。
2.設定Application為"整合式",進入進階段定後將"識別"改為Network Service。
3.設定Web.Config的<system.serviceModel>區塊
<system.serviceModel>
<services>
<service name="MT.WebApp.InsuranceService" behaviorConfiguration="asdf">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpBinding" contract="MT.WebApp.IInsuranceService" />
</service>
</services>
<diagnostics>
<endToEndTracing activityTracing="true" messageFlowTracing="true" propagateActivity="true"></endToEndTracing>
</diagnostics>
<bindings>
<basicHttpBinding>
<binding name="httpBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="asdf">
<!-- 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="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false"/>
</system.serviceModel>
4.設定Silver config檔。
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IInsuranceService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="TransportCredentialOnly" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/WebETOS/InsuranceService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IInsuranceService"
contract="ServiceReference.IInsuranceService" name="BasicHttpBinding_IInsuranceService" />
</client>
</system.serviceModel>
</configuration>
沒有留言:
張貼留言