无法加载程序集' Microsoft.AI.Web'

时间:2017-12-13 11:13:16

标签: c# asp.net silverlight

我有一个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创建器更新后我开始出现此错误。

编辑: 我忘了提及我使用Visual Studio 2012 Update 5

1 个答案:

答案 0 :(得分:4)

不确定你是否解决了这个问题但是...我最近必须解决这个问题。

在我的情况下,依赖项是从父站点继承的。 如果您的站点位于使用ApplicationInsight的其他站点的子目录中,但您的站点使用ApplicationInsight,则可以通过在<remove>中添加<system.webServer> <modules>指令来尝试删除相关性您网站的部分web.config:

<system.webServer>
    <modules>
       <remove name="ApplicationInsightsWebTracking" />
    </modules>
</system.webServer>

OR

在IIS管理器中,在“站点”树中选择您的站点(而不是父站点),然后启动“模块”图标。如果显示ApplicationInsightsWebTracking,请右键单击它并选择Remove。