简体   繁体   English

c#System.guid不包含Parse的定义

[英]c# System.guid does not contain a definition for Parse

AT.Anchor = System.Guid.Parse(DataBinder.Eval(e.Item.DataItem, "Anchor").ToString());

This throws: 抛出:

'System.Guid' does not contain a definition for 'Parse'

When I try and build it. 当我尝试构建它时。 But it runs fine, any idea how I can handle this better? 但它运行良好,任何想法我怎么能更好地处理这个?

Edit 编辑

Here is a section of my web.config 这是我的web.config的一部分

    <compilation defaultLanguage="c#" debug="true">
        <assemblies>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
            <add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
            <add assembly="MySql.Data.Entity, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
            <add assembly="MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/></assemblies>
    </compilation>

Guid.TryParse是.NET 4的一部分。确保你是在构建和运行.NET 4,它应该没问题。

One of the things with IIS app pools is that the first web application that starts in an app pool determines the CLR version used by that app pool. IIS应用程序池的一个问题是, 在应用程序池中启动的第一个Web应用程序确定该应用程序池使用的CLR版本。

If the first app started was built for, say, .Net v1.1, then every app started after that will run against the v1.1 runtime. 如果第一个应用程序启动是为.Net v1.1构建的,那么之后启动的每个应用程序都将针对v1.1运行时运行。 If your app, which gets started next, was built for, say, the 4.0 runtime, you're unlikely to find happiness. 如果您的应用程序(下次启动)是为4.0运行时构建的,那么您不太可能找到快乐。 Some might consider this to be a feature. 有些人可能会认为这是一个功能。 Or not. 或不。

"Start", in this case, means "receives an HTTP request". 在这种情况下,“开始”表示“接收HTTP请求”。 This means that the runtime version you get is essentially random: it depends on what the clients do, and in what order, after your bounce the app pool or bounce IIS. 这意味着您获得的运行时版本基本上是随机的:它取决于客户端执行的操作以及退回应用程序池或退回IIS后的顺序。

You need to be careful to put your web apps in appropriate app pools. 您需要小心将Web应用程序放在适当的应用程序池中。 Either bundle each web app in its own app pool, or set up an app pool per CLR version and be careful to put your web apps in the correct app pool. 将每个Web应用程序捆绑在自己的应用程序池中,或者为每个CLR版本设置一个应用程序池,并小心将您的Web应用程序放在正确的应用程序池中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM