asp.net mvc身份验证仅在调试时有效

编程入门 行业动态 更新时间:2024-10-27 23:24:13
本文介绍了asp mvc身份验证仅在调试时有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个asp mvc应用程序,在Visual Studio下运行良好,但是当我将其发布到本地主机时,我无法登录.

I have an asp mvc application that works fine under visual studio but when I publish it to the localhost, I'm unable to login.

我已经精简了代码,发现MembershipService.ValidateUser(model.UserName, model.Password)不起作用,但是下一行FormsService.SignIn(model.UserName, model.RememberMe)可以正常工作.

I already striped down the code and found that MembershipService.ValidateUser(model.UserName, model.Password) won't work but the next line FormsService.SignIn(model.UserName, model.RememberMe) works fine.

在网络配置中,我得到了以下信息:

On the web config I got the following:

<membership defaultProvider="MySqlMembershipProvider"> <providers> <clear/> <add autogenerateschema="true" connectionStringName="ConnString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/" name="MySqlMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> </providers> </membership> <profile defaultProvider="MySqlProfileProvider"> <providers> <clear/> <add name="MySqlProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="ConnString" applicationName="/" autogenerateschema="true"/> </providers> </profile> <roleManager enabled="true" defaultProvider="MySqlRoleProvider"> <providers> <clear/> <add name="MySqlRoleProvider" autogenerateschema="true" connectionStringName="ConnString" applicationName="/" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </providers> </roleManager>

ConnString没问题,因为应用程序的其他部分工作正常(包括FormsService.SignIn).

The ConnString is ok because other parts of the application work just fine (including the FormsService.SignIn).

Visual Studio调试应用程序的物理路径在哪里,以便我可以将Web.configs与本地IIS上的Web.configs进行比较?

Where's the physical path where Visual Studio debug applications so I can compare Web.configs with the one on my localhost IIS?

推荐答案

我能够找到问题所在,实际上有点令人尴尬.

I was able to found the problem, it was kinda embarrassing actually.

我当时使用框架4.0构建该项目,但是正在使用 framework 2.0将其部署到应用程序池中.

I was building the project with framework 4.0 but was deploying it to a Application pool using framework 2.0.

尽管我仍然发现ValidateUser方法依赖于框架,这很奇怪

Though I still find strange that the ValidateUser method depends on the framework

更多推荐

asp.net mvc身份验证仅在调试时有效

本文发布于:2023-11-13 21:35:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585380.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:身份验证   asp   net   mvc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!