服务器错误,禁用WCF服务

问题描述:

我正在ASP.NET中使用Visual Studio 2010实现基本身份验证WCF服务。我通过大致遵循this guide的前几个部分完成了此操作。服务器错误,禁用WCF服务

我有默认的ASP.NET Web站点(在VS2010)登录页面设置为使用我的WCF服务对用户进行验证,使用该代码隐藏和<asp: Login>属性:

protected void Login_Authenticate(object sender, AuthenticateEventArgs e) 
{ 
    bool isAuthenticated = false; 

    string customCredential = "Not used by the default membership provider."; 
    bool isPersistent = LoginUser.RememberMeSet; // Authentication ticket remains valid across sessions? 

    AuthenticationServiceClient authClient = new AuthenticationServiceClient(); 

    isAuthenticated = authClient.Login(LoginUser.UserName, LoginUser.Password, customCredential, isPersistent); 

    e.Authenticated = isAuthenticated; 
    authClient.Close(); 
} 

此外,当我使用IIS Express时,我有这个工作,但我已经转移到IIS 7.5。

当上述函数被调用时,在调用authClient.Login(...)时会抛出异常。

通常的错误页面会弹出这样说的:

服务器错误/ AuthClientSite“应用程序。

AuthenticationService被禁用。

描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关该错误的更多信息以及源代码的位置。异常详细信息:System.ServiceModel.FaultException`1 [[System.ServiceModel.ExceptionDetail,System.ServiceModel,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]]:AuthenticationService被禁用。

因为这些代码几乎相同的IIS表达什么工作,而且因为它好像我的服务仅仅是禁用,我在某处IIS,需要加以固定猜测它的设置。

我正在打包System.Web.ApplicationServices.AuthenticationService服务,如the link from above所示。

发生什么事情的任何想法将是一个很大的帮助。过去几天我尝试了很多不同的东西,我不记得和/或将它们全部列出,但我会尽我所能来回答你所有的问题/评论。

+0

IIS7.5的App池运行时的标识是什么?应用程序池是在运行还是停止? – rt2800

+0

我对所有术语都陌生,但我的网站正在运行Identity:根据IIS管理器的“ApplicationPoolIdentity”。它的状态是“开始”,所以我猜测它的运行。此外,它的v4.0 .NET和集成管道模式。 – kevlar1818

所以我想出了我的问题。我需要在网站上运行的服务,这些行添加到Web.config文件:

<system.web.extensions> 
    <scripting> 
     <webServices> 
      <authenticationService enabled="true" 
       requireSSL = "false"/> 
     </webServices> 
    </scripting> 
</system.web.extensions> 

希望这有助于谁运行在将来这个问题的人。