7

I have created a simple web API using .Net Core and trying to publish it to IIS. But getting HTTP 500.

I followed https://docs.asp.net/en/latest/publishing/iis.html article and did exactly whatever mentioned in that.

I Installed only https://www.microsoft.com/net/download as

DotNetCore.1.0.1-WindowsHosting.exe OPT_INSTALL_REDIST=0

NOTE : I am able to deploy and access MVC application successfully but cannot access WebAPI application with the same steps.

In the IIS logs i am seeing below error.

Failed to start process with commandline '"dotnet" .\Project-1.dll', ErrorCode = '0x80070002'.

I am using the default web api template provided in Visual Studio 2015

am i missing something. Is WebAPI deployment is different to MVC app deployment w.r.t .net core ?

6
  • Could you give us a little more information? Are you targeting just .NET Standard, or are you using platform-specific code? Web API and MVC aren't separated in .NET Core like they were in the past, so that isn't likely to be the sticking point. Are the app pools the same for your MVC app and your Web API? Commented Sep 26, 2016 at 14:10
  • 2
    I am targetting .NetCore App 1.0.1. I am using the same app pool with not managed set. I am using basic WebAPI template provided by Visual studio. You can replicate it i think. Commented Sep 26, 2016 at 14:19
  • One last question, then I'll see if I can get it to happen locally for me: If you check your IIS logs, are there any relevant details? That error code is a bit of a catch-all. Commented Sep 26, 2016 at 14:52
  • I am getting the the same error code which i updated in the question. I think it may be related to installation of .net core on IIS. I can deploy it locally but not on server. Commented Sep 27, 2016 at 10:24
  • Ok, this is what it took for me (if this works we'll move it to an answer so others can see it easier). First, check you system (not user) PATH variable to make sure the installer added dotnet to your path. If it didn't, add it. Either way, IIS won't pick this up while it is running. Go into services and restart the Windows Process Activation Service. This will restart all of the IIS bits and get it to update the path. Commented Sep 27, 2016 at 13:20

1 Answer 1

6

When you install the .NET Core Windows Server Hosting bundle, it won't restart all of the IIS processes if IIS is currently running. This is a good thing, since on a production server you wouldn't want them just to restart, but it would be nice if it was made a little clearer. First, check your System (not User) PATH variable to ensure that the path to Dotnet is there. Then, go into services and restart the Windows Process Activation Service. This will restart all of the IIS bits and get it to update the path. Once you've done this, IIS should serve up your .NET Core app just fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.