稍作更改后,Global.asax解析错误并恢复为以前的版本 [英] Global.asax parse error after minor change and revert to previous version

查看:106
本文介绍了稍作更改后,Global.asax解析错误并恢复为以前的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文中的项目是:

  • ASP .NET Web应用程序
  • .NET Framework:4
  • 平台目标:x86
  • IDE:Visual Studio 2010 Ultimate SP1
  • 解决方案中有多个项目,其中ASP.NET是启动项目.

它已经投产了几个月,直到昨天才出现故障.我清理了[Global.asax]文件(使用语句删除了未使用的文件,进行了重构等),运行了解决方案并得到以下错误:

It has been in production for months without glitches until yesterday. I cleaned up the [Global.asax] file (removed unused using statements, refactored, etc.), ran the solution and got the following error:

说明:在解析服务于此请求所需的资源期间发生错误.请查看以下特定的解析错误详细信息,并适当地修改您的源文件.
解析器错误消息:无法加载类型'CloudTech.ATS.WebClient.Global'.
源文件:/global.asax 行: 1
源错误:第1行:<%@ Application CodeBehind="Global.asax.cs" Inherits="CloudTech.ATS.WebClient.Global" Language="C#" %>

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'CloudTech.ATS.WebClient.Global'.
Source File: /global.asax Line: 1
Source Error: Line 1: <%@ Application CodeBehind="Global.asax.cs" Inherits="CloudTech.ATS.WebClient.Global" Language="C#" %>

这是 Global.asax标记:

<%@ Application CodeBehind="Global.asax.cs" Inherits="CloudTech.ATS.WebClient.Global" Language="C#" %>

这是 Global.asax.cs代码(内部代码已删除):

Here is the Global.asax.cs Code (with internal code removed):

using System;
using System.Linq;

namespace CloudTech.ATS.WebClient
{
    public class Global: System.Web.HttpApplication
    {
    }
}

在尝试了一段时间此错误之后,我进行了搜索,然后重新启动计算机,对解决方案进行了完全清理,强制重建,但无济于事.沮丧的是,我最终仅将Web应用程序目标更改为"Any CPU",并且可以正常工作.不幸的是,"Any CPU"不是当前问题的选择或解决方案.将其更改回"x86"会带来相同的错误.这种情况曾经发生过一次,此后,不再结合使用目标平台或调试/发布配置(相同的错误).

After wrestling with this error for a while, I searched, restarted my computer, performed a full clean on the solution, force rebuilt but with no avail. Frustrated, I finally changed only the web application target to "Any CPU" and it worked. Unfortunately, "Any CPU" is not an option or a solution to the issue at hand. Changing it back to "x86" brings the same error back. This happened once and since then, no combination of target platform or debug/release configuration works anymore (same error).

此外:

  • 我的开发机器都是x64.
  • 签入解决方案,让多个同事在他们的机器(x86和x64)上进行测试,结果相同.
  • 从3天前开始将整个项目恢复到干净状态,并且错误仍然存​​在!
  • 已验证完全没有对Web.config文件或解决方案中的任何其他文件进行任何更改.

最后,对我的开发系统所做的唯一更改是Windows更新(常规安全更新),并且我在没有更新的系统上尝试了该解决方案,并获得了相同的结果.

Lastly, the only change to my development systems has been windows updates (regular security updates) and I have tried the solution on systems without updates with the same results.

任何帮助将不胜感激.

推荐答案

清理解决方案并删除程序集对后续构建没有影响.我的解决方案是将Web应用程序的项目设置中的输出路径更改为Bin(而不是bin/x86/Debug).

Cleaning the solution and deleting the assemblies made no difference to subsequent builds. My solution was to just change the output path in project settings for the web app to Bin (rather than bin/x86/Debug).

来源:- 无法加载类型[Namespace].Global"使我悲伤

这篇关于稍作更改后,Global.asax解析错误并恢复为以前的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆