ASP.Net网站管理工具配置

笔者想使用ASP.NET Web 应用程序管理工具来添加身份验证。

点击项目->asp.net配置打开了ASP.Net网站管理工具页面:


然后点击security选项卡,出现如下问题:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. 

The following message may help in diagnosing the problem: Unable to connect to SQL Server database.


笔者用的编程环境是VS2012。

解决方法:

详细介绍参考《asp.NET 2.0中的登陆控件简介 》
其中文中提及到的asp.net Web Site Administration Tool中Security需要一些相关的设置才可以应用,具体设置方法如下:
(Microsoft MSDN:http://forums.microsoft.com/msdn/showpost.aspx?postid=81990&siteid=1&PageID=0

在你的SQL服务器上建立asp.NET 2.0的应用程序支持数据,需要建立一些表,缺省是放在aspnetdb的数据库里面。而安装时并没有生成aspnetdb数据库所以出错。

首先,运行 aspnet_regsql(C:\windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe) 来安装membership所要建立的数据库

在向导中选择SQL验证,输入数据库的用户名、密码(以前建的)。


然后,修改机器上web.config文件(C:\ windows \Micr os oft.NET\Framework\v2.0.50727\CONFIG\web.config)或者是工程的web.config文件。
要注意<connectionStrings> ... </connectionStrings>这个节

在本工程web.config中添加如下语句:

<connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer"
    connectionString="Data Source=THINK-PC;Initial Catalog=aspnetdb;Persist Security Info=True;User ID=sa;Password=123456"
    providerName="System.Data.SqlClient" />
  </connectionStrings>

成功!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值