我为一个需要基本密码保护的客户设置了一个简单的预览网站。我正在使用在web.config
中指定的凭据进行表单身份验证。
一切都在我的电脑上运行良好(最后的话)
然而,当我部署到运行Win2008的生产网站时,身份验证代码会尝试打开SQL Server数据库(在web.config
中没有任何SQL的引用)。我如何禁用此行为,以便身份验证基于我在web.config
中输入的凭据?
事件日志中的异常
无法连接到SQL Server数据库。
在System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString)
在System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install)
在System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString)
在System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString)
...
在System.Data.SqlClient.SqlConnection.Open() at System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, 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>