简体   繁体   中英

ASP.NET MVC 5 Membership with OWIN - Login functionality not working correctly under IIS 8

As the title suggests, I am unable to properly log in to my web app whilst it is hosted on IIS 8. It works as expected using IIS Express locally.

The Provider returns an "Unexpected Error".

I have checked that the OWIN middleware is loading, as I am able to register a new user just fine. I can also see using FireBug that the AspNet.ApplicationCookie is being set for the session.

The problem seems to be that when logging in, I am being redirected back to the login page, as opposed to the page I requested. Is there something under IIS 8 Specifically that might be causing this? As i said, It works as expected using IIS Express locally.

I have root access to the server, and so can make any IIS changes necessary.

It seems the problem was related to my SQL server connection string in the Web.Config.

Apparently it would seem that I cannot connect to my instance of SQL server using a connection string where the host address is the local servers public interface. Switching the host to "localhost" did the trick.

What's interesting is how suppressed this error was. I only managed to find it after installing Elmah.

http://www.raboof.com/projects/elmah/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM