点击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. 
点击Choose Data Store,提示
Use this page to configure how Web site management data such as membership is stored. You can use a single provider for all the management data for your site or you can specify a different provider for each feature. Select a single provider for all site management data 
Select a different provider for each feature (advanced) 
点击Select a single provider for all site management data 
提示如下:
Use this page to select a provider for storing site management data.  
  
Provider  
AspNetSqlProvider  Test  
 
点击test,提示
Provider Management  
Could not establish a connection to the database. 
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.  
 
不知道是什么原因,望各位高手赐教!
谢谢!

解决方案 »

  1.   

    详细介绍参考《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所要建立的数据库。
    然后,修改机器上web.config文件(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config)或者是工程的web.config文件。我的工程下的web.config文件如下:
       要注意<connectionStrings> ... </connectionStrings>这个节
     
    <?xml version="1.0"?>
    <!-- 
        Note: As an alternative to hand editing this file you can use the 
        web admin tool to configure settings for your application. Use
        the Website->Asp.Net Configuration option in Visual Studio.
        A full list of settings and comments can be found in 
        machine.config.comments usually located in 
        \Windows\Microsoft.Net\Framework\v2.x\Config 
    -->
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
     <appSettings/>
     <connectionStrings>
          <remove name="LocalSqlServer" />
          <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=aspnetdb;Integrated Security=True"
           providerName="System.Data.SqlClient" />
        
      <add name="NorthwindConnectionString" connectionString="Data Source=.;Initial Catalog=Northwind;Persist Security Info=True;User ID=sa;Password=vivian"
       providerName="System.Data.SqlClient" />
     </connectionStrings>
     <system.web>
      <!-- 
                Set compilation debug="true" to insert debugging 
                symbols into the compiled page. Because this 
                affects performance, set this value to true only 
                during development.
            -->
      <compilation debug="true"/>
      <!--
                The <authentication> section enables configuration 
                of the security authentication mode used by 
                ASP.NET to identify an incoming user. 
            -->
      <authentication mode="Windows"/>
      <!--
                The <customErrors> section enables configuration 
                of what to do if/when an unhandled error occurs 
                during the execution of a request. Specifically, 
                it enables developers to configure html error pages 
                to be displayed in place of a error stack trace.
            <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->
     </system.web>
    </configuration>