Eri*_* J. 3 asp.net asp.net-membership
我为需要基本密码保护的客户设置了一个简单的预览网站.我正在使用表单身份验证和指定的凭据web.config.
但是,当我部署到运行Win2008的生产网站时,身份验证代码会尝试打开SQL Server数据库(我没有引用任何SQL web.config).如何禁用此行为,以便身份验证基于我输入的凭据web.config?
事件日志中的异常
无法连接到SQL Server数据库.在System.Web.Management.SqlServices.GetSqlConnection(String server,String user,String password,Boolean trusted,String connectionString)at System.Web.Management.SqlServices.SetupApplicationServices(String server,String user,String password,Boolean trusted,String System.Web.Data.ccessAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString)中的System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName,String dataDir,String connectionString)中的connectionString,String数据库,字符串dbFileName,SqlFeatures功能,布尔安装. .在System.Web.Management.SqlServices.GetSqlConnection上的System.Data.SqlClient.SqlConnection.Open()(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>
Run Code Online (Sandbox Code Playgroud)
Eri*_* J. 11
事实证明,在生产机器上,SQL成员资格提供程序是在machine.config中定义的.我不认为操作团队从默认的Windows 2008安装中改变了任何东西,所以通常情况下该平台也是如此.
要删除对更高级别定义的任何SQL提供程序的引用,请在web.config中包含以下内容
<membership>
<providers>
<clear />
</providers>
</membership>
<roleManager enabled="false">
<providers>
<clear />
</providers>
</roleManager>
<profile>
<providers>
<clear />
</providers>
</profile>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6230 次 |
| 最近记录: |