2014-10-19 143 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實例。