你好这个我的配置文件
<?xml version="1.0"?> <configuration> <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=4.4.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" requirePermission="false"/> <sectionGroup name="elmah"> <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler,Elmah"/> <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler,Elmah"/> <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler,Elmah"/> <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler,Elmah"/> </sectionGroup> </configSections> <connectionStrings> <add name="DefaultConnection" connectionString="Data Source=.\sqlEXPRESS;Initial Catalog=aspnet-MedicallexiconProject-2012615153521;Integrated Security=True" providerName="System.Data.sqlClient"/> </connectionStrings> <appSettings> <add key="webpages:Version" value="2.0.0.0"/> <add key="webpages:Enabled" value="true"/> <add key="PreserveLoginUrl" value="true"/> <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/> </appSettings> <system.web> <compilation targetFramework="4.0" debug="true"/> <authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="2880"/> </authentication> <pages> <namespaces> <add namespace="System.Web.Helpers"/> <add namespace="System.Web.Mvc"/> <add namespace="System.Web.Mvc.Ajax"/> <add namespace="System.Web.Mvc.Html"/> <add namespace="System.Web.Routing"/> <add namespace="System.Web.WebPages"/> </namespaces> </pages> <profile defaultProvider="DefaultProfileProvider"> <providers> <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider,System.Web.Providers,Version=1.0.0.0,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/> </providers> </profile> <membership defaultProvider="DefaultMembershipProvider"> <providers> <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minrequiredPasswordLength="6" minrequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/> </providers> </membership> <roleManager defaultProvider="DefaultRoleProvider"> <providers> <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/> </providers> </roleManager> <sessionState mode="InProc" customProvider="DefaultSessionProvider"> <providers> <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/> </providers> </sessionState> <httpModules> <add name="ErrorLog" type="Elmah.ErrorLogModule,Elmah"/> <add name="ErrorMail" type="Elmah.ErrorMailModule,Elmah"/> <add name="ErrorFilter" type="Elmah.ErrorFilterModule,Elmah"/> </httpModules> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules runAllManagedModulesForAllRequests="true"> <add name="ErrorLog" type="Elmah.ErrorLogModule,Elmah" preCondition="managedHandler"/> <add name="ErrorMail" type="Elmah.ErrorMailModule,Elmah" preCondition="managedHandler"/> <add name="ErrorFilter" type="Elmah.ErrorFilterModule,Elmah" preCondition="managedHandler"/> </modules> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/> </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.sqlConnectionFactory,EntityFramework"/> </entityFramework> <elmah> <security allowRemoteAccess="false"/> </elmah> <location path="elmah.axd" inheritInChildApplications="false"> <system.web> <httpHandlers> <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory,Elmah"/> </httpHandlers> </system.web> <system.webServer> <handlers> <add name="ELMAH" verb="POST,Elmah" preCondition="integratedMode"/> </handlers> </system.webServer> </location> </configuration>
说明:处理服务此请求所需的配置文件时发生错误.请查看下面的具体错误详细信息,并适当修改您的配置文件.
解析器错误消息:无法加载文件或程序集“System.Web.Providers,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35”或其一个依赖项.该系统找不到指定的文件.
源错误:
Line 44: <membership defaultProvider="DefaultMembershipProvider"> Line 45: <providers> Line 46: <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider,PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minrequiredPasswordLength="6" minrequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/> Line 47: </providers> Line 48: </membership>
解决方法
我想你应该设置Copy Local = true并确保使用相同版本的.net框架.