IISExpress Custom Domains - asp.net

I've been (successfully) running a couple of ASP.NET (.NET Framework 4.6.2, WebForms) websites through Visual Studio 2017 / IISExpress using custom domains. I installed Visual Studio 2019 (Community) the other day, and all of a sudden the custom domains have stopped working on all projects in both Visual Studio 2017 and 2019! The system-tray for IIS Express still continues to show that the binding is accepted:
However, when attempting to browse to that URL, Chrome gives me a "ERR_CONNECTION_REFUSED" error:
Just to be clear, the steps are taken on each project are as follows:
Modify the applicationhost.config file in the web project's .vs folder to include:
<binding protocol="http" bindingInformation="*:80:agentdesktop.local" />
In an elevated command prompt, execute:
netsh http add urlacl url=http://agentdesktop.local:80/ user=everyone
Add to the hosts file:
127.0.0.1 agentdesktop.local
I've deleted the .vs directory, removed the urlacl entry, removed the IISExpress directory in the Documents folder. Performed all actions outlined above as had been done previously, and still I cannot get it to accept the connection!
If I ping agentdesktop.local then I get a valid response from 127.0.0.1, and the fact it's appearing in the IIS Express system tray, makes me think that something in between is intercepting and blocking.
Does anybody else have any ideas as to how I could get this back working again, or what might have gone wrong!?

I did some more digging, and found that running
netsh http show iplisten
Had a single entry of ::1. I removed this using:
netsh http delete iplisten address=::1
and everything started working again. Not quite sure what happened, but glad I found it.

Related

Unable to start debugging on web server, localhost subdomain

I am using VS2013, IIS7, and have set a subdomain in IIS and my hosts file to point to 127.0.0.1.
I've created the secondary website, and have the http binding in IIS pointing to localhost.subdomain.com.
Things i've tried:
IISReset
Deleting Site in IIS, Deleting app pools, re-building from scratch
Cleaning/Re-building solution/Restarting Computer/Visual Studio
Creating Virtual Directory through VS, even tried tying to IISExpress to no avail.
Also, i can go directly to the site in a browser just fine using the http://localhost.subdomain.com and traverse through it all, it just fails to load into Visual Studio for debugging. All debug info is set correctly through project properties as well.
There are a bunch of people within my office with the exact same setups that i've sat down with that work fine on their machines, but not on mine. I've exhausted my google and microsoft.com searches at this point, any suggestion would help.
Visual Studio is unable to resolve the domain because it likely hasn't been added to your hosts file.
If you edit the hosts file found at C:\Windows\System32\Drivers\etc\hosts to include your subdomain:
# rest of hosts file here
127.0.0.1 api.localhost
Then your debugger should start working again.

What is the worker process account in machine.config if <processmodel autoConfig="true">?

I'm trying to run a website on localhost using IIS in Windows 10.
I'd like to be able to access the website through another pc in the lan using a local ip address and port. I just started debugging the application in visual studio 2015, I could run
<binding protocol="http" bindingInformation="*:51258:localhost" />
but using
<binding protocol="http" bindingInformation="*:51258:192.168.1.213" />
causes an "Access Denied" popup in visual studio
I've followed the steps in
https://support.microsoft.com/en-sg/kb/894433
but was confused with step 7 i.e.
7. Add the worker process account that is configured in the processModel element in the Machine.config file
I was able to locate the machine.config file but the process model is set to autoconfig=true i.e.
Do I have to setup a custom account or is there a default worker process account that I'm not seeing?
This is so that I can do the following steps to solve the access denied problem...
5. In the Policy pane, right-click Impersonate a client after authentication, and then click Properties.
6. Click Add User or Group.
7. Add the worker process account that is configured in the processModel element in the Machine.config file.
Please note that I have already added the IUSR with permissions to the directories I'm running the website from.
ok after some more digging I finally made it work. I didn't have to add any worker account in the process model block of the applicationhost.config
I just had to install HTTP Activation from the advanced service as described in one of the answers in
what to do when accessing http://192.168.1.213:51258/Default.aspx doesnt work
I then followed with
netsh http add urlacl url=http://192.168.1.213:51258/ user=everyone
But that didn't solve it so I followed the change of configuration in visual studio web server to use custom server to finally fix this, found in the link below
how to setup custom web server in visual studio

IIS Express SSL This webpage is not available

I have a ASP.NET MVC5 project running on IIS Express and Visual Studio 2013. I want to add SSL support to localhost for testing. I have followed the steps detailed in numerous blogs. Specifically this one from Hanselman.
When I test my site via port 44300 I get the response "This webpage is not available" in chrome, "This page can’t be displayed" in IE and "Could not get any response" (response 0) from Postman.
I have confirmed correct binding information in applicationhost.config. I have confirmed sslcert bindings via netsh. I have confirmed urlacl bindings via netsh. I have tried running under Administrator privileges. I have disabled my firewall. I am at a loss of what to do next.
I have run IISExpress from the command prompt with Admin privilages. I got the following error :
iisexpress.exe /site:MvcApplication1
Successfully registered URL "localhost:52033/" for site
Failed to register URL "localhost:44300/" for site "MvcApplication1"
application "/". Error description: Cannot create a file when that
file already exists. (0x800700b7)
Failed to register URL
"https://*:44300/" for site "MvcApplication1" application "/". Error
description: Cannot create a file when that file already exists.
(0x80070 0b7)
EDIT
I have deleted the urlacl binding for port 44300. It resolved the iisexpress command line errors... That said, when I run and view my site I still get no response.
I got it working. My path was wrong. I was navigating to
localhost:44300
instead of
https://localhost:44300

"Unable to launch the IIS Express Web server" error

I receive this error when trying to launch IIS Express from Visual Studio with a project that's configured to listen to an address other than localhost. Visual Studio freezes for about 30 seconds before giving the error "Unable to launch the IIS Express Web server".
I've tried all the solutions posted to similar questions and I think I've done everything correctly. Here are the steps that I have taken:
Add the following reservation to HTTP.SYS:
netsh http add urlacl url=http://+:36899/ user=Everyone
Run Visual Studio 2012 as an administrator (technically I don't think I should even have to since I set up HTTP.SYS manually).
Disable Windows Firewall.
Delete my IISExpress folder in my My Documents folder to ensure the default settings.
Allow Visual Studio to create the entry in applicationhost.config for my web project. Then manually edit the config file to change localhost to 192.168.0.100 which is my local IP. Then go back into the project properties in Visual Studio and change localhost to the IP and save the project so that my project is now set to http://192.168.0.100:36899.
I also tried changing the port and repeating the above steps just incase the port was in use for some reason.
I want to make my IIS Express developer instance accessible from my IP on the Internet for remote testing.
If using VS2015, close the solution, delete the following file, then re-open the solution.
<<path_to_solution_folder>>\.vs\config\applicationhost.config
note the .vs folder may be hidden
The one thing that fixed this for me was using the following line in the <bindings> section for my site in the applicationhost.config file:
<bindings>
<binding protocol="http" bindingInformation="*:8099:" />
</bindings>
The key was to simply remove localhost. Don't replace it with an asterisk, don't replace it with an IP or a computer name. Just leave it blank after the colon.
After doing this, I don't need to run Visual Studio as administrator, and I can freely change the Project Url in the project properties to the local IP or computer name. I then set up port forwarding and it was accessible to the Internet.
EDIT:
I've discovered one more quirk that is important to getting IIS Express to properly serve external requests.
If you are running Visual Studio/IIS Express as an administrator, you must not add a reservation to HTTP.SYS using the "netsh http add urlacl ..." command. Doing so will cause an HTTP 503 Service Unavailable error. Delete any reservations you've made in the URLACL to fix this.
If you are not running Visual Studio/IIS Express as an administrator, you must add a reservation to the URLACL.
I had exactly the same issue. Tried everything but finally one trick worked.
Delete folder IISExpress from "My Documents"
Load your project again, it will create IISExpress folder again with updated configuration
Check IISExpress folder has sufficient permissions to read-write the configuration file
Load project again and Run IISExpress. It should work.
Close your project.
Go to folder settings and select show hidden folders option.
Open the folder where your application is. You will see a .vs folder.
Open the .vs folder, you will see a config folder in it. Delete its content.
Run Visual Studio in admin mode. Open your solution from the File menu.
Clean your solution.
Build it.
Run it and voila!
I do not recommend deleting IIS Express folder or messing with the config file in it.
I was changing this entry (for which my web server was not running and showing me access denied error for a particular port)
<bindings>
<binding protocol="http" bindingInformation="*:61235:localhost" />
</bindings>
in the "applicationhost.config" in "Documents\IISExpress\config" for a particular webapplication it was overwritten by Visual Studio 2012 again to default port whenever I was starting my webapplication.
But I resolved the problem by doing nothing in the applicationhost.config. I just changed the "project properties" > "web" > "project url" setting from http://localhost:62135/ to http://localhost:47279/(depends on your computer) and it worked for me.
Try this:
Open Properties of your solution
Go to web
under LOCAL IIS, Change written port number to any other port number and create a
new virtual directory.
Simply start your Visual Studio as Run as Administrator
Thanks,
I had the same issue, but with a different cause that may help others.
Use a commandprompt in admin mode for this:
- TYPE: netsh http show iplisten
If there are any IP entries:
- TYPE: netsh http delete iplisten
Repeat until the list is empty. Check if IIS Express starts now.
Hope this helps,
Niels
Deleting the unnecessary site entries from applicationhost.config file solved the issue for me.
For me it was the applicationhost.config file in .vs folder in my project solution folder(.vs folder is hidden by default).So,I closed the project and delete the .vs folder (vs will recreate it again when you open the project) then reopen the project and run it.
In my case i tried following things to fix this problem.
Delete the iisexpress folder from "MyDocuments"
Go to Solution Explorer --> Right click on the Project --> Go to Properties --> Go to Web tab --> See the Servers --> click on radio button "USe Visual Studio Developtment Server"
I hope this will help you.
I fixed it with the following steps:
Close Visual Studio
Run netsh http show urlacl and see if your application http address/port is listed.
Run netsh http delete urlacl url=[ADDRESS] replacing [ADDRESS] with the Reserved URL shown by the previous command. For example http://+:17560/
Run VS again (as Admin) then go to web project's Properties -> Web then click on Create Virtual Directory button.
Now you should be able to run the web project.
In Debug > Website Properties.
change port number in Project Url to any nearest value and save
I spent 1 hour trying every recipe mentioned above. Then out of no where I restarted my computer, and tried again. And everything is fine now.
So please try restarting your computer before trying all the above mentioned solutions. It might help
I had the same problem with Visual Studio 2012. I managed to resolve it by removing from C:\Program Files (x86)\IIS Express\AppServer\applicationhost.config path unneccessary site entries. Alongwith running my VS2012 as an Administrator. Hope this helps
At the start, Try to disable your firewall. It helped me. The Eset Smart Security 5 blocked it.
I had this problem some days ago and all of above items could not help me.
I have ESET Smart Security 5.0 on my SONY VAIO laptop which works in interactive mode!
Finally I found the problem, ESET was blocking VS2012!
In the past, ESET had asked me to allow the VS2012 to communicate with Microsoft, I had chosen "Deny Access" and ESET had mad a rule for denying
VS2012. I omitted this rule from "ESET rules zone" and my issue was solved!
Delete IISExpress folder in my My Documents folder to ensure the default settings or restore the same to previous version when it was working fine.
Remove the default website from the <sites> </sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
and your own <site> </site>
and run "C:\Program Files\IIS Express\iisexpress.exe"
http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-from-the-command-line
In VS 2013 I saw this error after setting up Google Docs synchronization on My Documents. Updated permissions to not be read-only and problem solved.
open command prompt as administrator
then execute this command :
netsh http show urlacl
you will see the url you have added before
now you should execute this command :
netsh http delete urlacl url=http://+:36899/ user=Everyone
please check the url from list when using :
(netsh http show urlacl)
I face this issue, All I did was go to the web project Properties -> Web -> In the ProjectUrl I clicked on the "Create Virtual Directory" and my issue was fixed.
I had the same issue with my computer having loads of windows updates.
Spent few hours trying to resolve the issue using above answers with no luck.
In past we have different issues due to anti-virus which caused the application to be blocked by it, so thought to try by disabling it.
So after trying all the solution, I just uninstall "One Drive" from my PC & the problem is resolved.
N.B:
I was trying to run .net core web application.
Visual Studio 2017 version 15.9.5
Windows 10 Pro, 64 bit
Click the Solution and press F4. Then match the port from Right-click on solution and select Properties to the web tab port.
The port no will be the same of both case F4 and Properties.
Tried deleting IISExpress folder, changed port , restart VS and PC but it didn't work.
However it worked after killing iisexpress.exe service in services.
change the parameter in the registry
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
parameter Start from 4 to 3 and reboot

Windows Server 2008 R2 + IIS 7.5 - Resource cannot be found

I have migrated our company web apps from Windows Server 2003 to Windows Server 2008 R2. The are all .Net 2.0 classic web apps. They all seem to work fine, except when accessing any resource with a path starting with /Reports/...
In one app the physical path on disk is c:\Websites\app_name\WebService\Reports... In this reports folder PDF files are dynamically generated and written to disk. They can be accessed via a URL such as this:
http://domain_name/Reports/xxxx.pdf
where /Reports is a virtual directory mapping to the physical path above. This worked fine on 2003 server & IIS6 but on IIS7.5 & 2008 R2 I keep getting the following error:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Reports/xxxx.pdf
I have another web app that generates the reports dynamically and streams them directly to the client browser for saving to the local disk, rather than being written to disk on the server. Similar to the above example, the page that generates the report is found under path as follows:
/Reports/Viewer.aspx
In this case there is no virtual directory being used. The URL referenced in the browser is:
http://another_domain_name//Reports/Viewer.aspx
Once again I get the same error message as above... HTTP 404 - The resource cannot be found.
I have tried all the permission settings under the sun to try and get it working but to no avail. I've use built in accounts, created new accounts with permissions from very minimal right up to full admin rights. I've also played with the new AppPool Identities with no success. It doesn't seem to matter what permissions I set specifically on the directories, or the accounts configured for the app pool or basic settings on each website itself.
Once thing I have discovered though, is that whilst the browser is getting the HTTP 404 error, there is no record of this request appearing in the IIS log files for each website!! This is really confusing me, as I would definitely expect to see a failed 404 log entry on the requested resource.
Something else to note, I'm running SQL Server 2008 Enterprise on this machine with Reporting services installed and enabled. It's a stretch, but could there be some contention over the /Reports path in my websites vs something else running on the machine? I'm using different bindings/host headers for each individual domain and website running on the server.
Check Reports folder conflict. And remember, Google is faster than SO.
IIS gives 404 errors for more than just File Not Found these days - so it doesn't give away too much to attackers. Have a look at the event log (application), and also try accessing it from the server itself.
The other thing to check is that your IIS app pools are correctly configured - especially with the correct pipeline mode and .NET framework version.
At a command prompt, type:
netsh http show urlacl
See if there are any bindings with /reports/ --maybe a left over from a SQL Server Reporting Services install?
v/r
BK

Resources