Can I have two or more WebMatrix sites running at once? - webmatrix

I'm using WebMatrix2 to run some test sites locally on my box. Each site of course is given its own port number by WM2 (eg localhost:15632 or localhost:12643)
What I haven't figured out is how to run two of those WebMatrix (I suppose they're actually IIS Express sites under the hood) at the same time, so I don't have to go back to the WM interface and choose a site to open. Since these sites each run under a different port can I not run them simultaneously? Or is this a limitation of IIS Express?

You can run multiple sites under IIS Express by starting them from the command line. Navigate to the directory containing iisexpress.exe (usually C:\Program Files (x86)\IIS Express) then use the following command where mySite represents the site to start:
iisexpress /site:mySite
or you can simply open multiple instances of WebMatrix.
Once you have opened your sites, you can manage them from the Notifications area on your task bar.
Here's more about running IIS Express from the command line: http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-from-the-command-line

Related

IISExpress keeps refusing connections from custom domain

Tried both Visual Studio 2015 and 2017 with the latest updates, different web apps (.NET Framework and .NET Core based). IISExpress is 10.0, Windows 10 Pro.
When I run a web app like http://localhost:49217, it works. If it's http://mydomain:49217, I get "mydomain refused to connect". At the same time, if I do "ping mydomain", it's successful.
I did:
"mydomain 127.0.0.1:" in hosts file
<binding protocol="http" bindingInformation="*:49217:mydomain" /> in applicationhost.config (both replacing localhost entry and keeping both localhost and mydomain)
made sure that this is the actual applicationhost.config (as there are many locations of them in different Visual Studio versions). For instance, when I change settings directly in Visual Studio, I see that this file gets updated.
"netsh http add urlacl url=http://mydomain:49217/ user=everyone" under Admin privileges
I tried to run Visual Studio as Admin and also running IISExpress directly (also as Admin):
C:\WINDOWS\system32>"c:\Program Files\IIS Express\iisexpress.exe" /config:"c:\solution_path\.vs\config\applicationhost.config" /site:"solution"
Starting IIS Express ...
Successfully registered URL "http://localhost:49217/" for site "solution" application "/"
Successfully registered URL "http://mydomain:49217/" for site "solution" application "/"
Successfully registered URL "http://*:49216/" for site "solution" application "/"
Registration completed for site "solution"
I then see incoming connections when it's localhost but not mydomain.
I tried to turn off Windows Defender Firewall for Private and Public networks, to no avail.
What else can I do?
EDIT:
I now tried to run one of web apps (.NET Core one) under Kestrel and this worked from the start, I can access http://mydomain:49217 just fine. It's only IISExpress which isn't working, and I have to to use IISExpress, Kestrel is not an option for me.
You could install our free VS extension called Conveyor (in Tools->Extensions). It will open a new port that will accept connections from other host names.
Eg. it will open port 45455, then you can go to http://mydomain:45455
You won't need the binding changes anymore, but you will need to keep the hosts file change of course. Also you can signup for tunneling if you want to use one of our subdomains to access over the internet.

How to debug ASP site without port number on VS 2012 Express

I'm trying to debug an ASP.NET 4.0 web site using Visual Studio Express 2012. I've configured the project settings to use the local IIS web server which was installed with VS. I need to use IIS so that urlrewritingnet will work.
I need to run the site locally without a port number. Currently it runs as http://localhost:4652/ which breaks some of the routines since they reference Request.Url.Host. This results in attempts to access resources using http://localhost/.
There is a lot of code to this site and it would be extremely easier and quicker (I think) to just configure my local debug to run on localhost instead of localhost:4652. Is there a way of doing this?
Since it's IIS Express installed with VS there is no configuration manager for IIS. When I click PROJECT -> mysite Properties and change the Project Url (under Use Local IIS Web Server) to http://localhost/ I get a warning that reads:
The local IIS Express URL http://localhost/ specified for Web project mysite has not been configured. To keep these settings you need to configure the virtual directory. Would you like to create the virtual directory now?
When I click on Yes, I get another dialog box saying:
Unable to create the virtual directory http://localhost/
Does anyone know if this should or should not work and if it can work, how do I do it?
You can go to "user/documents/iisexpress/config" then open applicationhost with notepad or other relevant editor then go find "bindings" then change the value of bindingInformation into "*:80:localhost". Done
Its really simple. You need to attach the IIS process to the visual studio and browse the website.
Below article guides to achieve this.
http://www.codeproject.com/Articles/37182/Debug-your-ASP-NET-Application-while-Hosted-on-IIS
Its always a good practice to do a unit test of web apps to local iis while developing.

Stop a web site hosted with IIS Express from command line

I'm working on a web solution in Visual Studio 2010 that is using IIS Express to host the application. I want the build process to copy the output DLLs from some of the projects into a directory under the main web app. There is a watch on this directory that keeps MEF current. The problem is that my builds fail because they can't copy the dlls over the existing ones because the application is left running every time I debug. What I'd like to do is add a build command that stops the site before the build begins.
I was expecting to be able to run AppCmd Stop Site "MySiteName" but appcmd says that STOP is not supported for site objects.
Are there any ways to stop a site from running in iis express from the command line?
Option-1:
If you don't have any other sites running, try
"taskkill /IM iisexpress.exe"
Note: This stops all iisexpress.exe processes
Option-2:
Write some executable utility for doing this. Following link may help you!
Starting and stopping IIS Express programmatically
Windows PowerShell's Stop-WebSite cmdlet is a command line way of stopping a Website hosted on IIS.

Need to name websites on localhost running on different Ports

I have my development PC on Windows 7 for ASP.NET and running Visual Studio 2010 and IIS 7 (NOT using the development web server). I have created multiple websites on different ports on my PC. E.g. http://localhost:8080 points to Website A. But when I open the site in Visual Studio, the project name shows as http://localhost:8080, as follows.
I would like to change that name to http://WebsiteA or http://WebsiteA:8080. Some identification.
I edited hosts and added
127.0.0.1 WebsiteA
Ping works fine. Also browsing WebsiteA:8080 works fine. But when I try opening the site (http://websitea:8080) in Visual Studio, it says Web site does not have Frontpage server extensions installed.
Is there any way to at least rename what's shown in the project list in Visual studio. I just need an identification on each website. I have about a dozen project and more may be added.
Thanks
IIS in Windows 7 allows you to have named virtual hosts. You can use that to separate out your sites. Visual studio cooperates with the naming of the virtual hosts. You will need to configure your visual studio project to operate against IIS (for debugging and running) rather than the visual studio built in web server.
Managed to find a way. This is what I did. Went to IIS Management, Created a new Website - Give it a name WebsiteA, Choose the folder where the web is located and give it a Host Name - WebsiteA. Click OK
Then go to Application Pools. You'll see your Host name there. Change the ASP.Net version to 4.0 or whatever you want. Then add a hosts entry 127.0.0.1 WebsiteA.
Now you can add http://WebsiteA in Visual Studio.
Thanks for all the help guys

Visual Studio: testing on different a server than developing on

In dreamweaver, it's really simple to set up a site so when you test a page that you are developing that it deploys it to a different test server that you are developing on and then browses to that page at that location also.
Question: Can you set up Visual Studio so that when you "run" or "View in Browser" that it automatically pushes the pages out to the test server and then browses to that location as well?
You've got two options as far as I can see:
1) Create a local project and set it up to run from your own local IIS, (this is not exactly what you're asking, but it should be more of an apples to apples test, as opposed to the built-in visual studio web server).
2) Use Remote Debugging to attach your Visual Studio instance to a remote server, links here and here
With option two, you'll still likely need to publish/deploy your solution to the server each time, but you will be able to step through and debug your code running on the remote server.
I think you can use an FTP project (File>Open Web Site and then select FTP) - as far as I'm aware, when you save a file it's automatically uploaded to the specified server. Then you could just point your browser at that web server.
I don't think this is possible,but you can always set up a shared folder where you put your code, and that shared folder is in fact the folder where your web server expect the code to be.

Resources