Running ASP.NET MVC 6 Web API from IIS - c#

I create a MVC 6 Web API project that is running as expected from Visual Studio, when I'm however deploying to production I'm getting a
An error occured while starting the application
error.
I did the following on the production machine
Installed ASP.NET 5 from https://get.asp.net
Made sure that the production environment is running the same dnx version
that the application was published with
Installed HttpPlatformHandler 1.2
Set the application pool .NET CLR Version to No Managed Code
Pointed the root location to the wwwroot folder
Is there anything else that I'm missing?

When you run into 500 errors, remember that ASP.NET 5 application can be self hosted,
Open a command prompt
Browse to the application directory
Type in web.cmd
I had some reference problems within my application that was listed in my command prompt which I subsequently fixed and everything worked as expected.

500 can be thrown by different failures. Take a look on http://docs.asp.net/en/latest/publishing/iis.html what u've missed in your configuration.
And you should call it ASP.NET Core 1

Related

HTTP Error 403.14 - Forbidden - ASP.NET Core 3.1 MVC

I have an ASP.NET Core 3.1 MVC application connected to a SQL database and it's
working perfectly when I launch it from Visual Studio with the IIS
Express profile.
I'm trying for more than a week just to publish it on IIS on my dev machine and I keep getting the error
HTTP Error 403.14 - Forbidden
I've done the below troubleshooting and searched for more with no result.
I make sure that my Windows account is a member of the administrators and IIS_users.
Install from Windows feature IIS services as attached picture.
Install SDK and .NET and runtime packages.
Made sure that the .NET Framework version value is v4.0
Note: after publishing to a folder, I deleted the web.config file since it's .NET Core 3.1.
note2: I have added a screenshot of my IIS how it looks after adding the website on it.
Please guide me on how could I fix this and many thanks in advance.

MVC 5.0 500 - Internal server error

I have created an MVC 5 website using Visual Studio 2015 on a Windows Server 2016 Machine.
I build and run the application from VS and it works great.
I published it locally, pointed IIS to the root folder.
The Application Pool is set to .Net CLR Version v4.0.30319.
When I try to access the page on the web, I get a generic error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
There is nothing in the IIS logs.
Not sure how to get this error so I can see it...or if it is a more basic issue. Any ideas on the best way to proceed?
To configure within Microsoft Server 2016, do the following:
Make sure you've installed the feature set for Web Server & Hosting are installed.
If those are installed, create a directory such as: "C:\Program Files\Sample"
Publish your application to the directory
Open Internet Information System
Disable Default Site
Create a New Site
Create a Site Name "Sample" (Take note of the Application Pool Name)
Now link "C:\Program Files\Sample" in Physical Path
For now leave the binding defaulted, this will trigger wildcard
Uncheck Start Website Immediately
Navigate back to "C:\Program Files\Sample" (Accessible through IIS also)
Right-Click and go to Permissions
Choose add new user
Type in "IIS AppPool\Sample"
Choose access your application will require.
Apply those changes, then navigate and start your web-site.
If that doesn't work, you can check the following:
Application Pool:
Sample should of defaulted to integrated and 4.0, if not change it. If your utilizing .Net Core application, you want it to be Unmanaged Code
Programs and Features:
Make sure that you have .Net 3.5, 3.0, 2.0 enabled.
Hostable Web Core & Internet Information System (Under Web Server) for you.
World Wide Web Services Enabled, with the proper Application Development Features.
Dependencies:
You may have to install https://www.microsoft.com/download/details.aspx?id=53840
If you have Core, you'll need: https://aka.ms/dotnetcore-2-windowshosting

Running Web API on IIS 6

I get a 404 Error when I try to run my Web API service on IIS 6. When I run it locally, it works. On IIS, my virtual directory is running .NET 4. The framework that my project is running is 4.0.
I have read many posts on this forum regarding the same issue, but haven't found a solution. Are there any special configuration settings on IIS 6 or code that needs to be written that enables IIS 6 to recognize Web API? Also, do I need to install MVC?

Unable to run ASP.NET Core rc2 in IIS

So, I've been trying to publish my Core App to local IIS server but whatever I do it just doesn't want to run.
What I do is find the project in windows explorer and open a command window there, and write the following:
dotnet publish --framework netcoreapp1.0 --output "C:/ReleaseWebsite" --configuration Release
Which well executes without any errors, and finally says that it published the project correctly.
After that I go to IIS and Add New Website, set it to port 80 or 8080, I even tried with 8088, and after set the path to the published files, I edit the Application Pool and set it to No Managed Code. Start the website but all I get it 500 error An error occurred while starting the application.
If I go manually to the published files and open GST.Web.exe it starts without any issues, and rusn on port 5000 and I can access it without any problems. But I want to run it in IIS. Any help?
Refer Publishing to IIS article.
I think you must have done all the steps from this article except installing .NET Core Windows Server Hosting bundle on the server.
Install the .NET Core Windows Server Hosting bundle on the server.
This bundle will install the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates the reverse-proxy between IIS and the Kestrel server.
See if this helps.

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

Categories