异常消息是:无法加载文件或程序集“App_Code”或其依赖项之一。该系统找不到指定的文件

时间:2012-06-12 09:46:01

标签: asp.net wcf iis

我正在尝试访问像xxx.svc这样的WCF服务端点。我收到了这个错误:

The exception message is: Could not load file or assembly 'App_Code' or one of its dependencies. The system cannot find the file specified

我打开了融合日志并得到了这个:

=== Pre-bind state information ===
LOG: User = xxx\xxx
LOG: DisplayName = App_Code
 (Partial)
LOG: Appbase = file:///D:/myService/
LOG: Initial PrivatePath = D:\myService\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\myService\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

我的Web应用程序中没有App_Code文件夹。为什么它要寻找App_Code ???

谢谢!

2 个答案:

答案 0 :(得分:1)

我在晚安睡觉后想出来。我忘记了precompiledApp.config文件。

答案 1 :(得分:0)

您可能使用了无效的引用,或者您没有引用您想要使用的内容。解决方案是检查您的web.config和所有引用,搜索所需但缺少的引用或无效引用。