【发布时间】:2016-09-19 16:19:24
【问题描述】:
我目前正在开发我的第一个 WCF Web 服务,托管在 IIS 8.5 中。我目前遇到了问题。
如果我使用 ApplicationPoolIdentity,服务至少会运行。我可以在浏览器中检查服务并查看 WSDL。如果我将 IIS 中的身份更改为域用户,则服务会在请求时关闭。我需要它以某些权限运行,因为该服务与我们的 Active Directory 一起使用。
我的网络配置:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
</httpModules>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode ="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="net.hasuma.webservices.portalx.AdfsService">
<endpoint address="" contract="net.hasuma.webservices.portalx.IAdfsService"
bindingNamespace="net.hasuma.webservices.portalx" binding="wsHttpBinding"
bindingConfiguration ="TransportSecurity"/>
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<!--
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="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
我知道关闭它的问题是什么(身份),但我不知道为什么会这样。我认为我的 webconfig 有问题。
一如既往地有一些限制。该服务可以写入 AD 目录,因此只允许 SSL。
【问题讨论】:
-
当域帐户出现问题(通常是无效密码)时,我经常看到这种情况。您可以使用该域帐户登录资源吗?
-
@Tim 是的,这是我当前的域帐户(用于测试)。如果我在 Visual Studio 上使用 IIS-Express 在本地运行 web 服务,它就可以工作,因为它可以毫无问题地与我当前的用户一起运行。