【问题标题】:ASP.NET Could not load type 'System.String'ASP.NET 无法加载类型“System.String”
【发布时间】:2009-01-23 20:09:19
【问题描述】:

有没有人见过 ASP.NET 网络套件在初次登录时出现问题,抱怨 web.config 中定义的配置文件中的 system.string 类型。

更多信息:

Server Error in '/abc' Application.
--------------------------------------------------------------------------------

Configuration 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: Attempting to load this property's type resulted in the following error: Could not load type 'System.String'.

Source Error: 


Line 222:           </providers>
Line 223:           <properties>
Line 224:               <add name="FirstName" type="System.String"/>
Line 225:               <add name="LastName" type="System.String"/>
Line 226:               <add name="DriverCode" type="System.String"/>


Source File: d:\Inetpub\wwwroot\abc\web.config    Line: 224 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 

【问题讨论】:

    标签: asp.net string


    【解决方案1】:

    我还没有看到,但是文档说 System.String 是默认设置,所以请尝试删除类型部分。

    【讨论】:

    • 约翰,谢谢你的想法。这个应用程序已经部署了几十次,没有问题。我确实继续尝试你所说的,但它仍然在 System.Boolean 属性上爆炸。还有其他想法吗?
    • 听起来部署中的某些东西被严重破坏了。是否应用了任何服务包,或任何其他会影响 ASP.NET 安装的东西?
    【解决方案2】:

    看看这个问答:Using a profile property of type List in .NET Membership

    尝试添加完全限定的程序集名称,例如:
    &lt;add name="MyString" type="System.string, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/&gt;

    这使它对我有用。

    【讨论】:

    • 获得完全限定程序集名称的一种方法是在类型上运行 AssemblyQualifiedName,如下所示: System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection(); Console.WriteLine(sc.GetType().AssemblyQualifiedName);
    猜你喜欢
    • 1970-01-01
    • 2016-06-03
    • 1970-01-01
    • 1970-01-01
    • 2012-09-07
    • 1970-01-01
    • 2014-03-14
    • 2017-11-24
    • 1970-01-01
    相关资源
    最近更新 更多