【发布时间】:2011-07-25 18:23:01
【问题描述】:
我为需要基本密码保护的客户设置了一个简单的预览网站。我正在使用带有web.config 中指定凭据的表单身份验证。
一切works fine on my box(著名的遗言)
但是,当我部署到运行 Win2008 的生产网站时,身份验证代码会尝试打开 SQL Server 数据库(web.config 中我没有引用任何 SQL)。如何禁用此行为,以便身份验证基于我在 web.config 中输入的凭据?
事件日志中的异常
无法连接到 SQL Server 数据库。
在 System.Web.Management.SqlServices.GetSqlConnection(字符串服务器,字符串用户,字符串密码,布尔值信任,字符串 connectionString)
在 System.Web.Management.SqlServices.SetupApplicationServices(字符串服务器,字符串用户,字符串密码,布尔信任,字符串连接字符串,字符串数据库,字符串 dbFileName,SqlFeatures 功能,布尔安装)
在 System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(字符串 fullFileName,字符串 dataDir,字符串 connectionString)
在 System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(字符串连接字符串)
...
在 System.Data.SqlClient.SqlConnection.Open() 在 System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trust, String connectionString)
http://my.site.com/Login.aspx?ReturnUrl=/
web.config(相关部分)
<system.web>
<compilation targetFramework="4.0" />
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="Login.aspx" protection="All" timeout="30">
<credentials passwordFormat="SHA1">
<user name="me" password="SHA1OfMyPassword" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
<allow users="me" />
</authorization>
</system.web>
【问题讨论】:
标签: asp.net asp.net-membership