Aspnet core 2.1.4 IIS start issues - c#

I made a simple POC in AspNet Core 2.1.2 a few days ago without any issue.
I was able to run it either from IIS Express & local IIS (hosted or started/debugged via Visual Studio).
I updated the project to the latest AspNet Core 2.1.4 yesterday and cannot seem to run any AspNet Core application in my local IIS now.
I created a new project (without https) to be sure the migration wasn't the issue.
About my environment :
Visual Studio 2017 (15.8.4)
IIS 10.0.17134.1
Latest packages downloaded from here (even if already included in the latest VS release) : https://www.microsoft.com/net/download/dotnet-core/2.1
Downloads
Test case :
Created an new "ASP.NET Core Web Application" -> API -> No authentication & no HTTPS
NetCore version 2.1
Once the solution is created, running it directly into IIS Express works.
Selecting the other profile named with the application name also works (starts the console and the service correctly)
I then want to host it in my local IIS :
Add a new website with a custom port (5555) and the physical path set to the solution folder (where sits the bin/obj/program.cs/...)
Once created, browsing the site throws me a "Configuration error" : normal, there is no web.config available.
I then right-clic on my project in VS, select "Properties" and "Debug"
I Create a new profile as such :
Profile
I create a web.config file containing the following (and will be transformed as I change running profile) :
Web.config
The project is not "correctly setup" (correctly as my previous POCs with AspNet Core 2.1.2)
Issues :
If I try to browse the website through IIS, an error 500 occurs
If I try to debug the solution with the "IIS" profile, an error occurs as such :
Startup error
All the HttpFailure*.html files are empty (0kb)
There is no error in the event viewer
There is no error in the IIS log files when enabled
There is no log file when the parameter stdoutLogEnabled is set to true (except when launched via a profile different than the IIS one, but still, no error)
Tests
I tried to :
Restart my computer
Start VS as administrator
Give full permission on the file system where applicable to "Everyone" and the IIS pool user selected
IIS Express & "console" profile still works.
EDIT1 : I also uninstalled everything and tried to revert to 2.1.2 without success (still with the latest VS)

I managed to find what was missing :
In "Windows Features", the following element was not ticked :
"Internet Information Services" -> "World Wide Web Services" -> "Common HTTP Features" -> "Http Errors"
I know it was ticked before installing AspNet Core SDK/bundle, as detailed error pages were served.
Anyway, as soon as this option was enabled again, I was greated with an error stating I cannot override the parameter XXX since it is locked. I had to set it as read/write in the server Feature Delegation.
Then all went good.
I cannot imagine the "Http Errors" was restored to an untick value by installing the SDK/bundle and didn't unticked myself (again, local computer).
I'll put it on the IIS shenanigans tab...

Related

ASP.NET Core 6 Minimal web API Deploy To IIS

I tried to deploy my web API of .NET 6 in IIS SERVER in windows machine. I have done all the necessary configurations:
Adding IIS_USERS Access to web.config
creating pool with no managed code
installing ASP.NET Core Module/Hosting Bundle
Install .NET 6 SDK
After doing all these steps, I get this:
No web page was found for the web address: http://localhost:5100/swagger/index.html.
When I compare it to ASP.NET core 3.1, I see that the minimal api doesn't generate a runtimes folder.
Anyone knows how to solve this problem?
I have faced same issue and now it is working OK
In publish settings, I have
Configuration: Release
Target Framework: net6.0
Deployment Mode: Self-contained (this was framework-dependant before)
Target Runtime: win-x64
Give it a try
Just set the IIS port for the site.
That worked for me
From the left-side menu of the IIS manager, right-click on sites, then choose 'Add Website'. Configure the app and in Binding set the port to a valid one as shown in the image1.
If you already have the site configured, you can right-click on the site and go to 'edit bindings'
Add Web Site Dialog image

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

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.

Default mvc/webapi site works in IIS Express but not in IIS 7.5

I've googled and searched stackoverflow, the following were not helpful
RESTFul service works in IIS Express / VS2013 but not on IIS Server
- the hot fix when run says "The update is not applicable to your computer."
Different result in IIS express and IIS
- not running dotnetnuke or webmatrix
running Win7Pro, with IIS7.5 Have VS2013Pro udpate 3 installed, had VS14CTP installed but is now uninstalled.
Create a new project, chose Web Application, MVC+WebApi, have WebApi 2.2 installed via nuget.
Make no changes to app, hit F5, app starts in chrome, see default ASP.NET site with a link to home and api. Clicking the Api link takes you to a help page describing the api calls available.
Publish site to file system, create new IIS website, point site to published folder, add defaultAppPool user to folder. browse to site from within IIS Manager. Site displayes but no styles are displayed. Setup site as machinename:80 also tried machinename:50102. Not using SSL or any authentication.
In chrome console there are 3 errors (this does not happen in IISExpress)
Uncaught SyntaxError: Unexpected token < modernizr:1
Uncaught SyntaxError: Unexpected token < jquery:1
Uncaught SyntaxError: Unexpected token < bootstrap:1
Trying to navigate to the api link, just refreshes the page, the help page is not displayed.
Using fiddler to try to hit one of the services in IIS Express works as expected. Using fiddler to try to hit any of the servcies returns the default home page.
Please recall no changes made to code, just the default mvc+webapi solution created.
Checked application_start(), it contains
GlobalConfiguration.Configure(WebApiConfig.Register); as the second line.
Any help would be appreciated.
It basically comes down to how you created the solution. In visual studio 2013 Professional, File->New Project -> Visual C# -> Web -> ASP.NET Web Application Click OK. In the pop up under "Add folders and core refrences for:" MVC is checked and greyed out, you cannot un-select it. Check "Web API" check box, click ok. All will work fine while working in VS. However once published as release. Point IIS at published folder, if needed, navigate to page. Page loads but has errors as described above.
To avoid this, do not check the "Web API" check box when creating the new project. Add Web API to the solution after creating it, not during the creation.
VS version 12.0.31101.0 Update 4
.NET version 4.5.52747

Deploying ASP.NET MVC 3 Application To IIS

I have been using the embedded server that visual studio has to test my ASP.NET MVC 3 application and it has been working fine. I decided that I want to start using IIS on my local machine for my personal development environment as that is how the application is going to have to be deployed.
I installed IIS through the control panel on Windows 7 (so I am assume it is version 7/7.5) and enabled basically every option. I then open up the IIS Manager and added the website. I also added an entry in my hosts file so that the domain I gave the IIS Manager maps to 127.0.0.1.
I then started Visual Studio (as administrator) and opened up the solution. I changed the properties for a few of the references as mentioned in a "How to Web Deploy ASP.NET Applications" article (like System.Web.MVC, System.web.Routing, and a few others). I then went to the main project, right-clicked and clicked publish. I set everything in there for Web Deploy and published it. To double check I when to the folder that I set as the path for the website in IIS Manager and they was a folder called app as excepted (when publishing I gave it website/app so I was excepting that folder) and it had a number of different files.
Edited
At first I was getting a blank page. After restarting my server, I now get a page with the message:
Error Summary
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
It tells me the most likely issue is that directory browseing is not enable but I would have though that my application would be access from the url (sb.website.com/app). The only files that publish copied over into that folder is the Web.config and Global.asax (it also copied the folder Areas, bin, and Views). Is there some setting in IIS Manager I am missing something else that should be copied over in the publish?
Figured out the issue.
I had to do was run aspnet_regiis -i in command line.
to start - Add a test.html page in your solution just to exclude any extension issues. Try even adding it to your wwwroot folder as well and see if you can hit it from localhost/test.html

Categories