Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

.net

asp.net

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.

like image 826
Mohamed Faisal Abbas Avatar asked Sep 21 '16 13:09

Mohamed Faisal Abbas


4 Answers

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.

like image 74
Johan B Avatar answered Sep 24 '22 02:09

Johan B


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'

like image 33
Pulkit Avatar answered Sep 22 '22 02:09

Pulkit


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

Check this answer

like image 25
Stormhashe Avatar answered Sep 23 '22 02:09

Stormhashe


I get this when running my site with Target .Net Framework 4.5.2 but not when running with 4.6

like image 43
Rodney Ellis Avatar answered Sep 23 '22 02:09

Rodney Ellis