首先,我的开发环境:使用visualstudioprofessional2010的Win7笔记本电脑。IIS是
我正在尝试通过ASP.NET配置工具,如MVCMusicStore教程中所示。单击“安全”选项卡时,出现以下错误:
“选定的数据存储有问题。这可能是由于服务器名称或凭据无效或权限不足造成的。这也可能是由于未启用角色管理器功能造成的。单击下面的按钮可重定向到可以选择新数据存储的页面。
'HandiGamer.mvc应用程序'.
"
当我点击“下面的按钮”时,它告诉我我正在使用AspNetSqlProvider作为我的提供者。当我尝试测试它时,它告诉我:
如果尚未创建SQL Server数据库,请退出网站管理工具,使用aspnet\u regsql命令行实用程序创建和配置数据库,然后返回此工具以设置提供程序。“
事情是这样的:
-
当我通过调试器运行MVCMusicStore演示时,它的角色/用户管理工作正常。我可以将自己添加为客户,并从购物车中添加/删除项目。
尽管
这样,当我尝试使用配置工具时,也会出现同样的错误。
-
我只是想知道我是否遗漏了一些明显的东西,因为教程基本上是说“点击两个按钮,你就全部设置好了。”它实际上没有提到为此设置db。
我只是在这一点上被难住了。角色/用户管理是有效的(MVCMusicStore证明了这一点),但是配置工具不允许我打开、设置或编辑它的工作方式。它变得非常令人沮丧。任何帮助都将不胜感激。
编辑:我的web.config文件具体如下-
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="HandiGamer" connectionString="data source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|handigamer.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="HandiGamer" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="HandiGamer" />
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="HandiGamer" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="HandiGamer" />
</providers>
</roleManager>
<pages>
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>