本文介绍了无法加载文件或程序集“System.Web.Providers"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好这是我的配置文件

 <?XML版本=1.0&GT?;
<结构>
  < configSections>
    <节名称=的EntityFrameworkTYPE =System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,的EntityFramework,版本= 4.4.0.0,文化=中性公钥= b77a5c561934e089requirePermission =FALSE/>
    < sectionGroup NAME =ELMAH>
      <节名称=安全requirePermission =假TYPE =Elmah.SecuritySectionHandler,ELMAH/>
      <节名称=错误日志requirePermission =假TYPE =Elmah.ErrorLogSectionHandler,ELMAH/>
      <节名称=errorMailrequirePermission =假TYPE =Elmah.ErrorMailSectionHandler,ELMAH/>
      <节名称=errorFilterrequirePermission =假TYPE =Elmah.ErrorFilterSectionHandler,ELMAH/>
    < / sectionGroup>
  < / configSections>
  <&是connectionStrings GT;
    <添加名称=DefaultConnection的connectionString =数据源= \\ SQLEX $ P $干燥综合征;初始目录= ASPNET-MedicallexiconProject-201261​​5153521;集成安全性=真的providerName =System.Data.SqlClient的/>
  < /&是connectionStrings GT;
  <&的appSettings GT;
    <添加键=网页:版本值=2.0.0.0/>
    <添加键=网页:启用VALUE =真/>
    <添加关键=preserveLoginUrlVALUE =真/>
    <添加键=ClientValidationEnabledVALUE =真/>
    <添加键=UnobtrusiveJavaScriptEnabledVALUE =真/>
  < /的appSettings>
  <&的System.Web GT;
    <编译targetFramework =4.0调试=真/>
    <身份验证模式=表格>
      <形式loginUrl =〜/帐号/登录超时=2880/>
    < /认证>
    <网页和GT;
      <&命名空间GT;
        <添加命名空间=System.Web.Helpers/>
        <添加命名空间=System.Web.Mvc/>
        <添加命名空间=System.Web.Mvc.Ajax/>
        <添加命名空间=System.Web.Mvc.Html/>
        <添加命名空间=System.Web.Routing/>
        <添加命名空间=System.Web.WebPages/>
      < /命名空间>
    < /页>
    <型材defaultProvider =DefaultProfileProvider>
      <供应商>
        <添加名称=DefaultProfileProviderTYPE =System.Web.Providers.DefaultProfileProvider,System.Web.Providers,版本= 1.0.0.0,文化=中性公钥= 31bf3856ad364e35的connectionStringName =DefaultConnection的applicationName =// >
      < /供应商>
    < / profile文件>
    <会员defaultProvider =DefaultMembershipProvider>
      <供应商>
        <添加名称=DefaultMembershipProviderTYPE =System.Web.Providers.DefaultMembershipProvider,System.Web.Providers,版本= 1.0.0.0,文化=中性公钥= 31bf3856ad364e35的connectionStringName =DefaultConnectionenablePasswordRetrieval =false的enablePasswordReset设置=真requiresQuestionAndAnswer =假requiresUniqueEmail =假maxInvalidPasswordAttempts =5minRequiredPasswordLength =6minRequiredNonalphanumericCharacters =0passwordAttemptWindow =10的applicationName =//>
      < /供应商>
    < /会员>
    < roleManager defaultProvider =DefaultRoleProvider>
      <供应商>
        <添加名称=DefaultRoleProviderTYPE =System.Web.Providers.DefaultRoleProvider,System.Web.Providers,版本= 1.0.0.0,文化=中性公钥= 31bf3856ad364e35的connectionStringName =DefaultConnection的applicationName =// >
      < /供应商>
    < / roleManager>
    <的sessionState模式=是InProccustomProvider =DefaultSessionProvider>
      <供应商>
        <添加名称=DefaultSessionProviderTYPE =System.Web.Providers.DefaultSessionStateProvider,System.Web.Providers,版本= 1.0.0.0,文化=中性公钥= 31bf3856ad364e35的connectionStringName =DefaultConnection的applicationName =// >
      < /供应商>
    < /&的sessionState GT;
    <&的HttpModules GT;
      <添加名称=错误日志TYPE =Elmah.ErrorLogModule,ELMAH/>
      <添加名称=ErrorMailTYPE =Elmah.ErrorMailModule,ELMAH/>
      <添加名称=ErrorFilterTYPE =Elmah.ErrorFilterModule,ELMAH/>
    < /&的HttpModules GT;
  < /system.web>
  < system.webServer>
    <验证validateIntegratedModeConfiguration =FALSE/>
    <模块runAllManagedModulesForAllRequests =真正的>
      <添加名称=错误日志TYPE =Elmah.ErrorLogModule,ELMAHpreCondition =managedHandler/>
      <添加名称=ErrorMailTYPE =Elmah.ErrorMailModule,ELMAHpreCondition =managedHandler/>
      <添加名称=ErrorFilterTYPE =Elmah.ErrorFilterModule,ELMAHpreCondition =managedHandler/>
    < /模块>
  < /system.webServer>
  <&运行GT;
    < assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>
      < dependentAssembly>
        < assemblyIdentity名称=System.Web.Helpers公钥=31bf3856ad364e35/>
        < bindingRedirect oldVersion =1.0.0.0-2.0.0.0NEWVERSION =2.0.0.0/>
      < / dependentAssembly>
      < dependentAssembly>
        < assemblyIdentity名称=System.Web.Mvc公钥=31bf3856ad364e35/>
        < bindingRedirect oldVersion =1.0.0.0-4.0.0.0NEWVERSION =4.0.0.0/>
      < / dependentAssembly>
      < dependentAssembly>
        < assemblyIdentity名称=System.Web.WebPages公钥=31bf3856ad364e35/>
        < bindingRedirect oldVersion =1.0.0.0-2.0.0.0NEWVERSION =2.0.0.0/>
      < / dependentAssembly>
      < dependentAssembly>
        < assemblyIdentity名称=的EntityFramework公钥=b77a5c561934e089文化=中性/>
        < bindingRedirect oldVersion =0.0.0.0-4.4.0.0NEWVERSION =4.4.0.0/>
      < / dependentAssembly>
    < / assemblyBinding>
  < /运行>
  <&的EntityFramework GT;
    < defaultConnectionFactory TYPE =System.Data.Entity.Infrastructure.SqlConnectionFactory,的EntityFramework/>
  < /&的EntityFramework GT;
  <&ELMAH GT;
    <安全allowRemoteAccess =FALSE/>
  < / ELMAH>
  <位置路径=elmah.axdinheritInChildApplications =false的>
    <&的System.Web GT;
      <&HttpHandlers的GT;
        <添加动词=POST,GET,HEAD路径=elmah.axdTYPE =Elmah.ErrorLogPageFactory,ELMAH/>
      < / HttpHandlers的>
    < /system.web>
    < system.webServer>
      <&处理GT;
        <添加名称=ELMAH动词=POST,GET,HEAD路径=elmah.axdTYPE =Elmah.ErrorLogPageFactory,ELMAHpreCondition =integratedMode/>
      < /处理器>
    < /system.webServer>
  < /地点>
< /结构>

但是当主机赖斯此错误pulish
配置错误

说明:该请求提供服务所需的配置文件的处理过程中发生错误。请检查下面的特定错误详细信息并适当地修改配置文件。

分析器错误信息:未能加载文件或程序集System.Web.Providers,版本= 1.0.0.0,文化=中性公钥= 31bf3856ad364e35或它的一个依赖。该系统找不到指定的文件。

源错误:

  44号线:其中,会员defaultProvider =DefaultMembershipProvider>
45号线:其中,供应商>
46号线:其中,添加名称=DefaultMembershipProviderTYPE =System.Web.Providers.DefaultMembershipProvider,System.Web.Providers,版本= 1.0.0.0,文化=中性公钥= 31bf3856ad364e35的connectionStringName =DefaultConnectionenablePasswordRetrieval =假enablePasswordReset设置=真requiresQuestionAndAnswer =假requiresUniqueEmail =假maxInvalidPasswordAttempts =5minRequiredPasswordLength =6minRequiredNonalphanumericCharacters =0passwordAttemptWindow =10的applicationName =//>
47号线:LT; /供应商>
48号线:LT; /会员>


解决方案

我觉得你应该设置复制本地= TRUE,并确保使用.NET Framework的版本相同。

hello this my config file

<?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, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
      </providers>
    </profile>
    <membership defaultProvider="DefaultMembershipProvider">
      <providers>
        <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, 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, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
      </providers>
    </roleManager>
    <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" 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,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode"/>
      </handlers>
    </system.webServer>
  </location>
</configuration>

but when pulish on host rais this errorConfiguration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 44:     <membership defaultProvider="DefaultMembershipProvider">
Line 45:       <providers>
Line 46:         <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, 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>
解决方案

I think you should set Copy Local=true and ensure to use same version of .net framework.

这篇关于无法加载文件或程序集“System.Web.Providers&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 07:20