我正在部署一个新的网站作为我的主要网站,它运行得非常好。
除了一个遗留系统(c#.net)之外,所有位于根URL下的应用程序也能正常工作,这个系统被广泛使用,但不幸的是,我无法访问源代码。
当我运行这个遗留应用程序www.mysite.com/crm时,我会收到以下错误:
Server Error in '/crm' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to
service this request. Please review the following specific error details and modify
your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Optimization' does not
exist in the namespace 'System.Web' (are you missing an assembly reference?)
Source Error:
Line 17: <pages>
Line 18: <namespaces>
Line 19: <add namespace="System.Web.Optimization" />
Line 20: </namespaces>
Line 21: <controls>
Source File: e:\WebSites\newsite\Web.config Line: 19
Show Detailed Compiler Output:
Show Complete Compilation Source:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446
错误是在主站点运行应用程序时,列出了web.config文件。但是,这仅在我在主站点下运行应用程序时发生。
这是在Server 2008 R2和IIS7上运行的。
我该如何纠正这个问题?还能尝试什么?
更新
我不知道是否有所区别,但它在错误中引用的Web.Config是新网站的配置文件,而不是旧的应用程序的配置文件。我不确定为什么主站点的配置文件会成为一个因素。
澄清
我无法访问旧应用程序的源代码,因此无法调整该应用程序的属性。将优化dll粘贴到站点中也没有解决问题。它可能适用于其他用户,但对我来说却没有用。
解决方法
我在另一个URL下设置了新站点,并将流量重定向到根URL以让旧应用程序继续运行,直到我们可以替换它。这是一个非常笨拙的解决方案,但现在它能够运行。