简体   繁体   English

用户代码未处理System.Configuration.ConfigurationErrorsException,消息=无法加载文件或程序集'System.Web

[英]System.Configuration.ConfigurationErrorsException was unhandled by user code , Message=Could not load file or assembly 'System.Web

I have read the following article http://msdn.microsoft.com/en-us/library/ff650307.aspx , about how i can authenticate asp.net mvc users from multiple domains, so inside my asp.net mvc i did the following :- 我已阅读以下文章http://msdn.microsoft.com/zh-cn/library/ff650307.aspx ,有关如何从多个域对asp.net mvc用户进行身份验证,因此在我的asp.net mvc中,我做了以下:-

I added the following to my web.config:- 我在web.config中添加了以下内容:

<system.web>
    <membership>
      <providers>
        <add name="TestDomain1ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,               Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="TestDomain1ConnectionString" connectionUsername="ad-domainA.intra\it360ad.user" connectionPassword="$$$$$" />

      </providers>
    </membership>

&

<connectionStrings>

<add name="TestDomain1ConnectionString" connectionString="LDAP://ad-domainA.intra/CN=Users,DC=ad-domainA,DC=intra" />

and i added the following Account.controller:- 我添加了以下Account.controller:-

[AllowAnonymous]
        public ActionResult Login(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            return View();
        }

        //
        // POST: /Account/Login

        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult Login(LoginModel model, string returnUrl)
        {


            MembershipProvider domainProvider;

            domainProvider = Membership.Providers["TestDomain1ADMembershipProvider"];


            // Validate the user with the membership system.
            if (domainProvider.ValidateUser(model.UserName, model.Password))
            {

                if (Request.QueryString["ReturnUrl"] != null)
                {

                    FormsAuthentication.RedirectFromLoginPage(
                        model.UserName, false);
                }
                else
                {
                    // If there is no RequestUrl query string attribute, just set
                    // the authentication cookie. Provide navigation on the login page
                    // to pages that require authentication, or user can use browser
                    // to navigate to protected pages.
                    // Set second parameter to false so cookie is not persistent
                    // across sessions.
                    FormsAuthentication.SetAuthCookie(model.UserName, false);
                }
            }
            else
        {

            ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return View(model);
        }

            return RedirectToLocal(returnUrl);

        }

but when i type my user name and password inside the login screen and click on enter , i got the following error:- 但是,当我在登录屏幕上键入我的用户名和密码并单击enter时,出现以下错误:

System.Configuration.ConfigurationErrorsException was unhandled by user code HResult=-2146232062 Message=Could not load file or assembly 'System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 用户代码未处理System.Configuration.ConfigurationErrorsException HResult = -2146232062消息=无法加载文件或程序集“ System.Web,文化=中性,PublicKeyToken = b03f5f7f11d50a3a”或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 (C:\\Users\\john.john\\Desktop\\test login\\TMS\\TMS\\web.config line 39) (C:\\ Users \\ john.john \\ Desktop \\ test login \\ TMS \\ TMS \\ web.config第39行)
Source=System.Web BareMessage=Could not load file or assembly 'System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Source = System.Web BareMessage =无法加载文件或程序集“ System.Web,文化=中性,PublicKeyToken = b03f5f7f11d50a3a”或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。
Filename=C:\\Users\\john.john\\Desktop\\test login\\TMS\\TMS\\web.config 文件名= C:\\ Users \\ john.john \\ Desktop \\ test login \\ TMS \\ TMS \\ web.config
Line=39 StackTrace: at System.Web.Security.Membership.Initialize() at System.Web.Security.Membership.get_Providers() InnerException: System.IO.FileNotFoundException HResult=-2147024894 Message=Could not load file or assembly 'System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Line = 39 StackTrace:在System.Web.Security.Membership.Initialize()在System.Web.Security.Membership.get_Providers()内部异常:System.IO.FileNotFoundException HResult = -2147024894消息=无法加载文件或程序集'System .Web,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 Source=mscorlib FileName=System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a FusionLog==== Pre-bind state information === LOG: User = AD-ITSERVICES\\john.john LOG: DisplayName = System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | 来源= mscorlib FileName = System.Web,文化=中性,PublicKeyToken = b03f5f7f11d50a3a FusionLog =====预绑定状态信息===日志:用户= AD-ITSERVICES \\ john.john日志:DisplayName = System.Web,文化=中性,PublicKeyToken = b03f5f7f11d50a3a(部分)WRN:为程序集提供了部分绑定信息:WRN:程序集名称:System.Web,文化=中性,PublicKeyToken = b03f5f7f11d50a3a | Domain ID: 4 WRN: A partial bind occurs when only part of the assembly display name is provided. 域ID:4 WRN:当仅提供部分程序集显示名称时,将发生部分绑定。 WRN: This might result in the binder loading an incorrect assembly. WRN:这可能导致活页夹加载不正确的组件。 WRN: It is recommended to provide a fully specified textual identity for the assembly, WRN: that consists of the simple name, version, culture, and public key token. WRN:建议为程序集提供完全指定的文本标识,WRN:由简单名称,版本,区域性和公共密钥令牌组成。 WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue. WRN:有关此问题的更多信息和常见解决方案,请参见白皮书http://go.microsoft.com/fwlink/?LinkId=109270 LOG: Appbase = file:///C:/Users/john.john/Desktop/test login/TMS/TMS/ LOG: Initial PrivatePath = C:\\Users\\john.john\\Desktop\\test login\\TMS\\TMS\\bin Calling assembly : (Unknown). 日志:Appbase = file:/// C:/Users/john.john/Desktop/test login / TMS / TMS /日志:初始PrivatePath = C:\\ Users \\ john.john \\ Desktop \\ test login \\ TMS \\ TMS \\ bin调用程序集:(未知)。 === LOG: This bind starts in default load context. === LOG:此绑定在默认加载上下文中启动。 LOG: Using application configuration file: C:\\Users\\john.john\\Desktop\\test login\\TMS\\TMS\\web.config LOG: Using host configuration file: C:\\Users\\john.john\\Documents\\IISExpress\\config\\aspnet.config LOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\config\\machine.config. 日志:使用应用程序配置文件:C:\\ Users \\ john.john \\ Desktop \\ test login \\ TMS \\ TMS \\ web.config日志:使用主机配置文件:C:\\ Users \\ john.john \\ Documents \\ IISExpress \\ config \\ aspnet.config日志:使用C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\ config \\ machine.config中的计算机配置文件。 LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). 日志:目前未将策略应用于引用(私有,自定义,部分或基于位置的程序集绑定)。 LOG: Attempting download of new URL file:///C:/Users/john.john/AppData/Local/Temp/2/Temporary ASP.NET Files/root/2fc69b03/2c0137b8/System.Web.DLL. 日志:尝试下载新的URL文件:/// C:/Users/john.john/AppData/Local/Temp/2/Temporary ASP.NET Files / root / 2fc69b03 / 2c0137b8 / System.Web.DLL。 LOG: Attempting download of new URL file:///C:/Users/john.john/AppData/Local/Temp/2/Temporary ASP.NET Files/root/2fc69b03/2c0137b8/System.Web/System.Web.DLL. 日志:尝试下载新的URL文件:/// C:/Users/john.john/AppData/Local/Temp/2/Temporary ASP.NET Files / root / 2fc69b03 / 2c0137b8 / System.Web / System.Web.DLL 。 LOG: Attempting download of new URL file:///C:/Users/john.john/Desktop/test login/TMS/TMS/bin/System.Web.DLL. 日志:尝试下载新的URL文件:/// C:/Users/john.john/Desktop/test login / TMS / TMS / bin / System.Web.DLL。 LOG: Attempting download of new URL file:///C:/Users/john.john/Desktop/test login/TMS/TMS/bin/System.Web/System.Web.DLL. 日志:尝试下载新的URL文件:/// C:/Users/john.john/Desktop/test login / TMS / TMS / bin / System.Web / System.Web.DLL。 LOG: Attempting download of new URL file:///C:/Users/john.john/AppData/Local/Temp/2/Temporary ASP.NET Files/root/2fc69b03/2c0137b8/System.Web.EXE. 日志:尝试下载新的URL文件:/// C:/Users/john.john/AppData/Local/Temp/2/Temporary ASP.NET Files / root / 2fc69b03 / 2c0137b8 / System.Web.EXE。 LOG: Attempting download of new URL file:///C:/Users/john.john/AppData/Local/Temp/2/Temporary ASP.NET Files/root/2fc69b03/2c0137b8/System.Web/System.Web.EXE. 日志:尝试下载新的URL文件:/// C:/Users/john.john/AppData/Local/Temp/2/Temporary ASP.NET Files / root / 2fc69b03 / 2c0137b8 / System.Web / System.Web.EXE 。 LOG: Attempting download of new URL file:///C:/Users/john.john/Desktop/test login/TMS/TMS/bin/System.Web.EXE. 日志:尝试下载新的URL文件:/// C:/Users/john.john/Desktop/test login / TMS / TMS / bin / System.Web.EXE。 LOG: Attempting download of new URL file:///C:/Users/john.john/Desktop/test login/TMS/TMS/bin/System.Web/System.Web.EXE. 日志:尝试下载新的URL文件:/// C:/Users/john.john/Desktop/test login / TMS / TMS / bin / System.Web / System.Web.EXE。

  StackTrace: at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, 

StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) at System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) InnerException: System.RuntimeTypeHandle.GetTypeByName(字符串名称,布尔型throwOnError,布尔型ignoreCase,布尔型仅反射,StackCrawlMark&stackMark,IntPtr pPrivHostBRunType,类型TypeType) System.Web.Compilation.BuildManager.GetType(String typeName,Boolean throwOnError,Boolean ignoreCase)的System.Type.GetType(String typeName,Boolean throwOnError,Boolean ignoreCase)的布尔值throwOnError,布尔值ignoreCase,布尔值仅反射.Web.Configuration.ConfigUtil.GetType(字符串类型名称,字符串属性名称,ConfigurationElement configElement,XmlNode节点,布尔值checkAptcaBit,布尔值ignoreCase)InnerException:

on the following line of code inside the Account controller:- 在帐户控制器内的以下代码行上:-

public ActionResult Login(LoginModel model, string returnUrl)
        {MembershipProvider domainProvider;
domainProvider = Membership.Providers["TestDomain1ADMembershipProvider"];

so what is causing this error? 那么是什么导致此错误?

For this declaration of System.Web 对于此System.Web声明

System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

The version is also needed (4.0 right?) 还需要该版本(4.0对吗?)

Version=4.0.0.0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.Configuration.ConfigurationErrorsException - System.Configuration.ConfigurationErrorsException WCF:System.Configuration.ConfigurationErrorsException - WCF: System.Configuration.ConfigurationErrorsException C#-编译器错误:未处理System.Configuration.ConfigurationErrorsException - C# - Compiler Error: System.Configuration.ConfigurationErrorsException was unhandled c#:System.Configuration.ConfigurationErrorsException(临时文件) - c#: System.Configuration.ConfigurationErrorsException (empity file) System.Configuration.ConfigurationErrorsException-无法识别的元素“设置” - System.Configuration.ConfigurationErrorsException - Unrecognized element 'setting' System.Configuration.dll 中出现“System.Configuration.ConfigurationErrorsException”类型的未处理异常 - An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll 无法从程序集&#39;System.Web,...&#39;加载类型&#39;...&#39; - Could not load type '…' from assembly 'System.Web, …' &#39;System.Configuration.ConfigurationErrorsException:请求的数据库WebBank未在配置中定义 - 'System.Configuration.ConfigurationErrorsException: The requested database WebBank is not defined in configuration web.config中的SoapExtension System.Configuration.ConfigurationErrorsException无法解析属性“type”的值 - SoapExtension System.Configuration.ConfigurationErrorsException in web.config The value of the property 'type' cannot be parsed 无法在Windows 8 IIS上加载文件或程序集&#39;System.Web&#39;或其依赖项之一 - Could not load file or assembly 'System.Web' or one of its dependencies on Windows 8 IIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM