unable to configure iis express for vs 2017 - asp.net-core

Ever since the last windows update, I have been having problems configuring connecting to a local hostname. But my workaround was to connect to localhost:60856. Now all of a sudden, I can't connect at all with the following error:
the following error occurred when trying to configure IIS Express for Project MantleMapperDotNet.WebCore. The Web Server 'localhost:60856' could not be found
I have scoured the internet for this but to no avail. Following are the things I've tried:
1. deleted .vs folder in vs project
2. deleted IISExpress folder in documents
3. re-installed iisexpress
4. running vs2017 as admin (which i always do).
5. running netsh-http to see if there's a binding already
6. restarting windows
can somebody please tell me what exactly is going on and how i can resolve this issue?

Related

What is still missing in my attempt to host a blazor-server app?

I've been hitting my head against this wall for days now and to my knowledge I've followed every direction I've found. But I'm still getting a 500 Error when I browse to the URL.
What I've got to work with is a Windows Server 2012 R2 with IIS 8.5. I'm not married to IIS but I'd prefer not to dip into YET another tech just to get this running.
What I've done:
Old-style blazor-server app (with Program / Startup pair) without authentication. Dependencies:
SharpZipLib
LiteDB
published it using dotnet publish -o bin/publish --self-contained -r win7-x64
copied that folder to the server
On the server:
installed urlrewrite2
installed everything under Windows Features Word Wide Web Services and Web Management Tools
restarted
created a new site in IIS
set the application pool to unmanaged
set the physical path to the folder I copied from my dev system
What I haven't done:
Anything regarding Visual Studio as I'm currently forced to contend with Visual Studio Code and none of that applies/is possible here.
Provisional Workaround
running dotnet my.dll --urls http://*:1234 does work to expose the app to the network
the command needed to be run inside the application folder otherwise the app would fail to load the connection string.
I've also had to provision a production database and modify my appsettings.json accordingly
This is workable for now but not having the app "auto start" with the server is unsatisfactory.

VS2019 Cannot launch .NET Core ASP 2 web site and browse from another computer on the same network

I have been trying to browse a website run under IIS Express VS2019 from another computer on the same network. I see the following error.
Bad Request - Invalid Hostname
I found several discussions where people suggested adding bindings and I did try adding so many different bindings in applicationhost.config with specific hostname, IP, hostname+ip, wildcards. When I add any binding or modify the existing localhost binding VS 2019 start giving me the following error
Unable to connect to web server 'IIS Express'
I am running VS2019 as an admin. What else I am missing?
Here is what I discovered. I do not have admin privileges on my local PC. Our sysadmin had created a shortcut for me which launches VS2019 as an admin. However, the VS was still not run as elevated Admin privileges. Turns out, you need to be an admin, and you must right-click the VS2019 shortcut and choose Run As Administrator with a shield and say Yes to the warning. The shortcut wasn't doing none of that. Now my custom IIS Express bindings are picked up from applicationhost.config without any issue.

Visual Studio 2017 Published web application returns 500 error

I have tried creating a test default net core web application which runs fine with IIS Express on my local machine. When I publish it to the server (Win 2012 R2), it returns a 500 error when I hit the website. Nothing is logged in the Event Log or IIS logs. I've installed the ASP.NET Core Module and restarted the server and still get the error. From what I've read, it's supposed to deploy a testproject.dll and web.config points to that but mine is generating an executable instead and web.config is pointing to that. Everything is in the root of the website as well so I'm not sure what else I can do. I didn't change any code in the test project, just using the default demo app to make sure I can get it running on a server.
Please help!
After a lot of testing, I finally figured out that there was a few error with IIS bindings, and permissions. Now everything is working.

How do I restore a missing IIS Express SSL Certificate?

After setting up HTTPS in IIS Express, according to such articles as this and this, I am unable to actually load an IIS Express site using HTTPS. In Chrome, I am only getting:
This webpage is not available (with error code "ERR_CONNECTION_RESET")
...and in IE I am only getting:
Internet Explorer cannot display the webpage
...when I follow the directions in those articles.
It appears this has to do with the fact that the "IIS Express Development Certificate" that IIS Express installs automatically has been removed. How do I get this certificate reinstalled?
Windows 10 users: Repair is only in the Control Panel, not in the Add Remove programs app. I typically run appwiz.cpl to launch the old control panel applet and run repair from there.
Windows 7 and 8.1:
After going to Add/Remove Programs and choosing the "Repair" option on IIS Express, the certificate has been reinstalled and I can now launch IIS Express sites using HTTPS.
The certificate is back:
And I can now launch the IIS Express site using HTTPS:
For Visual Studio 2015, IIS Express 10, Windows 10, these options didn't work for me. IIS Express 10 didn't have a repair option.
I managed to solve the problem using the IisExpressAdminCmd.exe command available at C:\Program Files (x86)\IIS Express.
From an elevated command prompt run:
cd C:\Program Files (x86)\IIS Express
IisExpressAdminCmd.exe setupsslUrl -url:urlToYourSite -UseSelfSigned
Replacing urlToYourSite with your url.
e.g.
cd C:\Program Files (x86)\IIS Express
IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:44387/ -UseSelfSigned
After that I closed IIS Express and restarted my site from Visual Studio and it prompted to automatically trust the self-signed certificate.
Also note that for IIS Express to work with SSL, the port used needs to be in the 44300 through 44399 range (http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-without-administrative-privileges).
So, if you're using IIS Express in Visual Studio, make sure the port selected is in the required range:
vs setting for iis express
Sometimes this error is because of a different certificate installed for localhost. If that is the case, there is no need to restore the IIS Express certificate. Instead, you can do the following to tell IIS Express to use your existing certificate:
Open the Certificates MMC snap-in as described here
Find your localhost certificate e.g. under Personal...Certicates and get its thumbprint:
Bring up the properties dialog for the localhost certificate and find the Thumbprint property
Paste the thumbprint value into Notepad (or whatever) and remove the spaces and any special characters at the beginning
Find the port value of your IIS Express project:
Go to the project properties in Visual Studio and finding the "SSL URL" value, e.g. "https://localhost:44300/MyApp".
In this example 44300 is the port number. If yours is different, change that value in the later commands.
Use the following commands in an administrative command prompt (not Powershell):
netsh http delete sslcert ipport=0.0.0.0:44300
netsh http add sslcert ipport=0.0.0.0:44300 certhash=your_cert_hash_with_no_spaces appid=
{123a1111-2222-3333-4444-bbbbcccdddee}
The Guid in the above command can be replaced with one that you generate. It does not correspond to any existing IIS Express value.
For further reference see Handling URL Binding Failures in IIS Express.
With new Chrome 58, nothing from the answers below will help. I've just spent 1 hour uninstalling / reinstalling certificates and trying to find out where the problem is.
Apparently Chrome 58 will refuse certificate because "missing_subjectAltName"
The solution is either "badidea" passphrase or if you need to open popups for login you have to use:
chrome://flags/#allow-insecure-localhost
The source is and the upvote belongs to: https://stackoverflow.com/a/38926117/2089232 :)
I wanted to add this, because it is ridiculous but maybe it will help someone. Keep in mind that I had never opened my project properties before so I have no idea how this happened (I did not change this myself or have the opportunity to), but in Project > Properties > Web my SSL url was listed as my usual URL but as http instead of https (had previously been https because it was working before). I went through all the steps listed on this page, uninstalled VS, then IIS, and finally noticed the error which should have been https://mySSLURL (but was missing the s in https). Once I changed http to https everything worked again.
I just had this issue after updating my VS 2017 to the latest version(s) and created a new (.Net) MVC/WebAPI project (from template). I was able to fix this by adjusting my port numbers to be within the correct range
Chorme Default Port Ranges for DEV SSL
Which I was able to find here: https://www.pluralsight.com/guides/visual-studio-2017-resolving-ssl-tls-connections-problems-with-iis-express
Hope this helps!
You can reinstall IIS Express 10.0 (or whatever version you need) to fix the missing certificate. Download from Microsoft here

Server 2012 IIS site on different drive

I'm trying to get IIS 8 on a brand new Server 2012 up and running to run a .net 4.5 app and I can't get it to work across drives
Error: 500.19
Module
IIS Web Core
Notification
Unknown
Handler
Not yet determined
Error Code
0x80070005
Config Error
Cannot read configuration file due to insufficient permissions
Config File
\\?\D:\callsheet-test\web.config
The current site is just a single file index.html.
If I copy the folder to anywhere on c: like c:\callsheet-test\ or c:\inetpub\callsheet-test it works perfectly once I change the target location in IIS 8 (site > basic settings).
It doesn't matter if there is an web.config file as a complex mvc/webforms app gives the same error.
I have tried copying the file with permissions and even thought the permissions seem to match for all users. I am still getting this error.
I have deleted the partition and and recreated it as a mount point c:\mount and the same issue happens. Copy the files to c:\notamount and they work fine.
This server is running on a VMware server. Windows 2012 x64 Standard.
Based on further investigation of the problem (via link in my comment above), I've found a workaround via here: change the Group Policy value of "Audit Removable Storage" from "Not Configured" to "No Auditing" and reboot. Bizarre I know. This setting is in Windows Settings/Security Settings/Advanced Audit Policy Configuration/System Audit Policies/Object Access.
Even though we're using VMWare and not Hyper-V this workaround still worked for me. Hopefully Microsoft can provide a answer.
I also had the same error and the solution was similar. I had installed Sql Server 2012 on Windows Server 2012 and it was at this time that I noticed IIS worker processes running from the system C: drive were unable to access configuration files on the E: drive. The site could only be loaded when on the C: drive, despite all the necessary NTFS permissions being granted through IIS_IUSRS, IUSR, Users and/or even the specific AppPool itself. This became evident when IIS couldn't access the E: drive even when running the AppPool (.NET 4.5) using an admin account other than the ApplicationPoolIdentity account (IIS APPPOOL.NET v4.5 in this context - verified in procexp.exe). Installing Sql Server 2012 was throwing errors during installation and required enabling auditing for object access among other settings.
Solution:
Run -> secpol.msc
Security Settings -> Local Policies -> Audit Policy
Change "Audit Object Access" policy to "No Auditing"
Hopefully, this background helps ease someone's headache. :-)