简体   繁体   中英

How to solve 'Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies' error?

I upload my asp.net file in webserver. First it shows

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->



<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration

Then I add <customErrors mode="Off"> in web.config file.

After that when i run it shows the following error.

Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. The system cannot find the file specified.

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.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. The system cannot find the file specified.

I upload my projects file completely such as bin, css, js, images and forms. First time I am uploading in web server. Please tell me what should I do.

I had this exact same error while deploying an app containing application insights to production (worked on acceptance weirdly, but oh well) yesterday. Somehow the project was incorrectly configured to not copy a bunch of references (including the Microsoft.AI.Web reference).

The solution proved quite simple:

Install-Package Microsoft.ApplicationInsights.Web

This installed a new version of application insights and fixed the references. Alternatively, I would suspect that a reinstall of that package would do the same trick.

You could follow the below steps to solve the issue:

  1. Open IIS.
  2. Right click the 'Default Web Site'. Go to 'Manage Web Site' > 'Advanced Settings..'
  3. Check the 'Physical Path' value. It should be 'C:\\inetpub\\wwwroot'.

Note : The above steps would work if you have published your project as an Application under the 'Default Web Site' in IIS. In case you have publish your project as a different web site, you could try the similar steps to point it to your project and not to 'C:\\inetpub\\wwwroot'

You must have your reference set to "copy local" when deploying your website.

Check this answer

我在使用 Target .Net Framework 4.5.2 运行我的网站时得到这个,但在使用 4.6 运行时没有

I had similar issues. It started after I uninstalled an instance of visual studio 2017. I wanted to revert back to VS2015.

Cause

  1. It was probably caused by conflict in .Net Framework.

My Solution

  1. I Edited changed all the .Net Framework of my Projects to point to the same framework (.Net 4.6 framework)
  2. I cleared the bin folder of the project. Make sure this is selected for the bin folder to be visible

  3. I rebuilded the projects and the error stopped.

Just Remove the following tag line from web.config file

ApplicationInsightsWebTracking

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM