saf21
saf21

Reputation: 844

Missing assembly reference when application running in virtual application (IIS)

I got a main website(Net 4.5.2) in my IIS. Then I create separate webapi(Net 4.7.2) and run it as virtual application inside the main website. But, when I test the webapi to GET a data, it will give me an error about missing assembly reference. Below is the error.

Parser Error Message: Could not load file or assembly 'System.Web.Optimization' or one of its dependencies. The system cannot find the file specified.

Then I install this missing assembly to the webapi and then its working perfectly.

So, the problem is:

  1. Why do I need to install this assembly even my webapi doesn't used this assembly?
  2. Is it related with the web api run as virtual application inside my main website? or because of different version?
  3. How do I skip this without need to install unused assembly to the webapi?

Upvotes: 2

Views: 990

Answers (1)

saf21
saf21

Reputation: 844

I found an answer for this. It because of inheritance to the nested application in the IIS. Need to set inheritance to child application false in the main site web.config. Here is the solution link to this issue.

<location path="." inheritInChildApplications="false">
  <system.web>
    <!-- ... -->
  </system.web>
</location>

Upvotes: 2

Related Questions