简体   繁体   中英

Web API 2 get up and running on local IIS

I have Web API 2 C# project which runs fine through visual studio. I type URL to test like this:

http://localhost:51754/api/email/1

It shows me XML file. However when I publish and set up IIS I get

HTTP Error 403.14 - Forbidden.

I am new to this and my question is what kind of configuration I need to have it run on IIS. I am using .NET Framework Version 4.0 Integrated Application Pool to run it.

Probably ASP.NET is not registered within your IIS. Try running the following command from a DOS prompt with elevated user account:

C:\windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir 

Obviously you might need to adapt the path to aspnet_regiis.exe depending on your specific OS and version of the framework. Once you have registered ASP.NET 4.0 with IIS make sure that you restart it for changes to take effect:

iisreset

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