表单身份验证适用于dev服务器,但不适用于IIS

问题描述:

我们遇到了类似的问题。我们有一个在默认appdomain下运行的Web应用程序。它工作正常,直到一个星期......突然它遇到了一个问题。以下消息来自事件日志。

We have a similar problem. We have a web application running under default appdomain. It was working fine until a week before...Suddenly it has encountered a problem. Below message is taken from event logs.

Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied has expired. 

应用程序使用FormsAuthentication并从aspnetdb获取角色..错误之后,当用户登录到页面时,它不会重定向到default.aspx。再次登录login.aspx。另一方面,应用程序在开发服务器(localhost)上工作正常,但在www(IIS 6.0)上没有。

Application uses FormsAuthentication and gets the roles from aspnetdb.. After the error, when user logins to the page, it does not redirects to the default.aspx. Again login.aspx comes up. On the other hand application works fine on development server(localhost), but not on www(IIS 6.0).

有没有人有想法?

谢谢,

İlknur

当应用程序池运行的应用程序池处于集成管道管道模式(默认情况下为IIS 7)时,您需要添加

It looks that when Application Pool your app is running on is in Integrated Managed Pipeline Mode, which is default under IIS 7, you will need to add

<system.webServer>
  <modules>
      <add  name="FormsAuthenticationModule"  type="System.Web.Security.FormsAuthenticationModule" />

配置。

请参考从这篇文章

最初我在网页上添加了上述部分.config手动,但IIS抱怨运行时错误,所以我最终使用MMC面板为IIS(inetmgr)通过GUI添加它。应用程序的配置文件未被修改,但功能开始工作,所以我不确定哪个配置文件GUI工具应用了更改。

Initially I added aforementioned section to web.config by hand, but IIS complained with runtime error, so I ended up using MMC panel for IIS (inetmgr) to add it via GUI. Application's config file wasn't modified, but feature started to work, so I'm not sure which configuration file GUI tool applied the change to.