2009-07-06 71 views
1

我有一个ASP.NET(C#)上有一些预编译组件的Web应用程序。我一直支持它,没有任何问题,增加了功能和扩展。现在我正面临另一个需要调用远程SOAP服务的扩展。如何修改预编译的ASP.NET网站? Visual Studio抱怨该网站已预编译

我试着根据我在这里得到的一些建议 - 通过添加Web引用,创建代理类和所有这些,但Visual抱怨应用程序是预编译的。

以下是编译器的实际输出:

The directory '/trxv/App_WebReferences/' is not allowed because the application is precompiled. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The directory '/trxv/App_WebReferences/' is not allowed because the application is precompiled.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The directory '/trxv/App_WebReferences/' is not allowed because the application is precompiled.]
System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +8805619
System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +128
System.Web.Compilation.BuildManager.CompileWebRefDirectory() +31 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +312

[HttpException (0x80004005): The directory '/trxv/App_WebReferences/' is not allowed because the application is precompiled.]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

[HttpException (0x80004005): The directory '/trxv/App_WebReferences/' is not allowed because the application is precompiled.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8886319
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

是否还有其他或多或少简单(即高级别)调用SOAP客户端的方法,将不需要重新编译?不幸的是,该系统的原始源代码不可用。

+0

我认为你有一个更普遍的问题:如何扩展一个预编译的网站,但你没有源代码。这不仅仅是一个Web服务问题。 – 2009-07-06 22:01:32

+0

排序的事情是它有几个组件,它使用的是预编译和在主模板中使用。我没有触及那些。我只是创建一个新的页面,用一个新的表单来做一些远程SOAP调用...我可以一路下来打开HTTP连接并直接向服务交谈XML,但是我希望.NET有一些更好/更智能的达到此目的的方法。 – 2009-07-06 22:05:10

回答

1

Alex,

请注意我最近的编辑。这个问题与你没有Web应用程序的事实有关 - 你有一个Web站点。他们是独一无二的,很奇怪。

我从来没有使用它们,除非必须,所以我从来没有见过这个例外。尽管如此,它看起来还是最终的。所以这里是你如何解决这个问题:

创建一个单独的类库项目。将Web引用添加到类库并构建它。然后,看看你是否可以在你的网页中引用类库。类库应该包含代理类。