ASP.Net 5 IIS: Unable to resolve the following dependencies

I have an ASP.Net 5 MVC 6 project that uses several class libraries other than DNX. These libs are wrapped through dnu wrap and all jobs are found in IIS Express or self-service. However, an error is displayed on IIS 8

Failed to resolve the following dependencies for target structure 'DNX, Version = v4.5.1': list of my projects

Current target runtime is: 'DNX, Version = v4.5.1 (dnx451)' Version: 1.0.0-beta7-15532 Type: CLR Architecture: x64 OS Name: Windows OS Version: 6.3.9600.0

Same error if I use dnx 4.6 (I just downgraded to see if it works with 4.5.1).

However, libs can be found in the following location: approot \ packages \ with the correct nuget package structure (dnu publishes them packaged)

So, how can I help IIS find my libraries?

Steps to play:

  • Create a solution with two projects: a new ASP.Net MVC application and a regular class library (not a package)

  • Wrap a class library with dnu wrap

  • Class Class Library from MVC

  • Publish a web application (if publishing from Visual Studio does not work, use dnu publish -runtime active)

  • Create a website in IIS and point it to the wwwroot folder of the published web application.

UPDATE: It turned out that the problem is not in the IIS itself, but in DNX. I get the same error if I publish a website and then run it through Microsoft.AspNet.Server.WebListener. The dnu publication does not seem to work properly with wrapped projects.

However, this is not the case when you start the Windows service. I have a console application (package) that references the same libraries, I publish it with -no-source, and then install it as a windows service through sc.exe, and everything works as expected.

+5
source share
1 answer

My problem was that in project.json I had links without a library version, just empty lines. It works under Visual Studio, but not when working without VS. I had such links because in RC I did not add a link to the context menu, so I added it manually, and it worked. So, here is the step to configure the website to work in IIS:

1) Wrap projects without DNX with the "dnu wrap" command

2) Add the link from the DNX project to the project without DNX and make sure that you have the correct version in project.json (the version must be the same as in wrap \ yourproject \ project.json). Here is an example:

"frameworks": { "dnx46": { "dependencies": { "MyLib": "1.0.0-*" } } 

3) Publish your site with dnu posting

 dnu publish .\src\Web --out <outputfolder> 

4) Publish again with the runtime parameter. This runtime is copied to the output folder. But the wwwroot folder was not created this time, itโ€™s good that we already published in step 3 ;-). You can change the order of steps 3 and 4

dnu publish .\src\Web --out <outputfolder> --runtime dnx-clr-win-x64.1.0.0-beta7

5) Go to outputfolder\wwwroot\web.config and enter the values โ€‹โ€‹for 2 parameters in the appsettings: dnx-version and dnx-clr. Here is an example:

 <appSettings> <add key="bootstrapper-version" value="1.0.0-beta7" /> <add key="runtime-path" value="..\approot\runtimes" /> <add key="dnx-version" value="1.0.0-beta7" /> <add key="dnx-clr" value="clr" /> <add key="dnx-app-base" value="..\approot\src\Web" /> </appSettings> 

6) Create a new website in IIS, select the application pool with .Net v4.0 runtime

7) Direct your new website to the folder \ wwwroot

8) Make sure everything works

+3
source

All Articles