2014-10-19 114 views
0

我想登录一个,它不允许我。我很确定它必须处理web.config文件。大约在我使用管理工具将角色分配给(用户和员工)的同时,它停止工作。现在,我点击网站管理工具主页上的安全性后,它给了我一个错误,我无法连接我的SQL数据库。我不明白。我只想让用户能够登录并重定向到我想要的页面和员工相同的页面(也可以完全访问网站,而用户只能访问我坚持的一个页面)。下面我web.config:Asp.net网站管理工具错误

<?xml version="1.0"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=169433 
    --> 
<configuration> 
    <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> 
    </configSections> 
    <appSettings> 
    <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" /> 
    </appSettings> 
    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <handlers> 
     <remove name="ChartImageHandler" /> 
     <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" 
     path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
    </handlers> 
    </system.webServer> 
    <connectionStrings> 
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebApplication4-20140921152333;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebApplication4-20140921152333.mdf" providerName="System.Data.SqlClient"/> 
    <add name="PizzaConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\PizzaOrders.mdf;Integrated Security=True;Connect Timeout=30" providerName="System.Data.SqlClient"/> 
    </connectionStrings> 
    <system.web> 
    <httpHandlers> 
     <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
     validate="false" /> 
    </httpHandlers> 

    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5"> 
     <assemblies> 
     <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
     <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </assemblies> 
    </compilation> 
    <httpRuntime targetFramework="4.5"/> 
    <pages> 
     <namespaces> 
     <add namespace="System.Web.Optimization" /> 
     </namespaces> 
     <controls> 
     <add tagPrefix="webopt" namespace="Microsoft.AspNet.Web.Optimization.WebForms" 
      assembly="Microsoft.AspNet.Web.Optimization.WebForms" /> 
     <add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" /> 
     <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" 
      assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
     </controls> 
    </pages> 
    <authentication mode="Forms"> 
     <forms loginUrl="~/Account/Login.aspx" timeout="2880"/> 
    </authentication> 
    <profile defaultProvider="DefaultProfileProvider"> 
     <providers> 
     <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/> 
     </providers> 
    </profile> 
    <membership> 
     <providers> 
     <add connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> 
     </providers> 
    </membership> 
    <roleManager enabled="true"> 
     <providers> 
     <add connectionStringName="DefaultConnection" applicationName="/" name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> 
     </providers> 
    </roleManager> 
    <!-- 
      If you are deploying to a cloud environment that has multiple web server instances, 
      you should change session state mode from "InProc" to "Custom". In addition, 
      change the connection string named "DefaultConnection" to connect to an instance 
      of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express. 
     --> 
    <sessionState mode="InProc" customProvider="DefaultSessionProvider"> 
     <providers> 
     <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/> 
     </providers> 
    </sessionState> 
    </system.web> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> 
    </entityFramework> 
</configuration> 

回答

0

更改连接字符串“DefaultConnection”以连接到SQL Server实例。