谢谢你。在过去的一天半里,我一直在与这个战斗。这里有一些可以为我节省大量时间的东西。所以希望它会节省别人一些时间。我遇到了 SQLConnection 问题,并且使用传输安全性拒绝模拟抛出注册表访问。我什至尝试使用 transportwithmessagecredential。在 procmon 内部,我得到了“Bad Impersonation”。我的配置是 IIS 7,虚拟目录只启用了 Windows 身份验证,我禁用了内核模式身份验证。我将其设置为使用通过身份验证的基本设置。
服务配置 -
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
<services>
<service behaviorConfiguration="SymitarService.ScheduleServiceBehavior" name="SymitarService.ScheduleService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsSecure" contract="SymitarService.IScheduleService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="wsSecure" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SymitarService.UserDirectoryBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
<behavior name="SymitarService.ScheduleServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="tcpSecure" portSharingEnabled="true" />
</netTcpBinding>
<wsHttpBinding>
<binding name="wsSecure" allowCookies="true">
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
<mexTcpBinding>
<binding name="mexSecure" />
</mexTcpBinding>
</bindings>
</system.serviceModel>
和客户
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IScheduleService" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" useDefaultWebProxy="true" allowCookies="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:20:00" enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ImpersonationBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation" allowNtlm="true"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="https://server:444/SymitarService/ScheduleService.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IScheduleService"
contract="Symitar.ScheduleService.IScheduleService"
name="WSHttpBinding_IScheduleService"
behaviorConfiguration="ImpersonationBehavior"
>
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>