我有一个 Asp.net Silverlight 应用程序,当我运行该网站时突然开始收到以下错误:
could not load assembly 'Microsoft.AI.Web' or one of its dependencies...
我做了一些研究,发现这个程序集来自 ApplicationInsights,但是有问题的网站没有引用 ApplicationInsight,也没有 ApplicationInsights.config 文件,尽管我在同一解决方案中有另一个站点有它。此站点由另一位程序员通过不同的解决方案编辑。
如本回答所示:Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. The system cannot find the file specified ,我尝试使用以下命令安装 ApplicationInsights:
Install-Package Microsoft.ApplicationInsights.Web
但是当运行上面的命令时,我收到以下错误消息:
Attempting to resolve dependency 'Microsoft.ApplicationInsights (= 2.4.0)'.
Attempting to resolve dependency 'System.Diagnostics.DiagnosticSource (≥ 4.4.0)'.
Install-Package : 'System.Diagnostics.DiagnosticSource' already has a dependency defined for 'System.Collections'.
At line:1 char:1
+ Install-Package Microsoft.ApplicationInsights.Web
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
我不知道这是否只是巧合,但我在 Windows 10 安装 Falls creator 更新后开始出现此错误。
编辑: 我忘了说我正在使用 Visual Studio 2012 Update 5
请您参考如下方法:
不确定你是否解决了这个问题,但是......我最近必须解决这个问题。
在我的例子中,依赖关系是从父站点继承的。 如果您的网站位于另一个使用 ApplicationInsight 的网站的子目录中,但您的网站不使用 ApplicationInsight,您可以尝试通过添加 <remove> 来删除依赖项<system.webServer> <modules> 中的指令您网站的 web.config 部分:
<system.webServer>
<modules>
<remove name="ApplicationInsightsWebTracking" />
</modules>
</system.webServer>
或
在 IIS 管理器中,在站点树中选择您的站点(不是父站点)并启动模块图标。如果显示 ApplicationInsightsWebTracking,请右键单击它并选择删除。
