I'm just starting to use Visual Studio 2010 SP1 with IIS Express. When Visual Studio launches IIS Express, it specifies the name of the "site" to launch IIS Express with. The name of the site seems to be derived from the name of my web project. Is it possible to have Visual Studio launch a site with some other name? For instance, if my web project's name is "WebProject1", when Visual Studio launches IIS Express, it will use the following command:
iisexpress.exe /site:WebProject1
I would like to force it to do this instead:
iisexpress.exe /site:MyMasterSite
Any ideas out there?
You will want to change this in the applicationhost.config file. This can be found in the user/documents/iisexpress/config folder. In the config file, under the system.applicationhost node you will find a sites node that should allow you to set the name in the site name node.
<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>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
Related
I am troubleshooting why IIS Express cannot find my web.config after I moved my ASP.NET Core project.
(HTTP Error 500.19 - Cannot read configuration file - web.config file)
My research revealed that most people were changing the applicationhost.config file. However, when I open my applicationhost.config file I only see what looks to be the default entry (WebSite1 is not my project name):
<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>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
I also understand that the launchSettings.json file has options that IIS Express uses. For example, I've changed my localhost port to 4444 in my launchSettings.json file:
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4444",
"sslPort": 0
}
},
Before I moved my project, everything was working. Also, if I choose to run my project using "web" in Visual Studio (Kestrel I think), it works just fine even after the move.
So my question is how and/or where does my ASP.NET Core application set the specific settings for IIS Express? Of particular interest to me is how I can find and change the physical path to my project so that IIS Express can find my web.config.
When moving your project make sure to copy the root folder so that all files within the folder are included. It sounds like you just copied over the "src" folder which does not contain everything.
If you copy the root folder over and open the project it will run fine. As Lex Li noted above, there is a hidden folder called .vs which contains a config folder with applicationhost.config.
I'm implementing OAuth authentication in a MVC6 site using VS2015 RC. The previous incarnation of the site required a custom binding and I'm trying to achieve the same with VS2015. Debugging with IIS Express, however, is proving difficult.
If I amend the dnx "web" command to use an alternate url, all works as expected:
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://www.devurl.co.uk:31122",
"gen": "Microsoft.Framework.CodeGeneration",
"ef": "EntityFramework.Commands"
},
If I try and do the same thing with IIS Express by changing the applicationhost.config file (within the project/.vs/config folder as per Wildcard hostname in IIS Express + VS 2015)...
<sites>
<site name="WebApp1" id="1">
<!-- removed for brevity -->
<bindings>
<binding protocol="http" bindingInformation="*:31122:www.devurl.co.uk" />
</bindings>
</site>
<!-- removed for brevity -->
</sites>
...a new site entry is with a binding to "localhost".
<sites>
<site name="WebApp1" id="1">
<!-- removed for brevity -->
<bindings>
<binding protocol="http" bindingInformation="*:31122:www.devurl.co.uk" />
</bindings>
</site>
<site name="WebApp1(1)" id="2">
<!-- removed for brevity -->
<bindings>
<binding protocol="http" bindingInformation="*:31122:localhost" />
</bindings>
</site>
<!-- removed for brevity -->
</sites>
The site is now running using the localhost binding. VS happily opens the dev url and tells me that the service is unavailable.
How can I instruct VS2015 to use the existing site and binding when debugging with IIS Express?
I used the instructions as defined here with a slight modification:
Wildcard hostname in IIS Express + VS 2015
In order to make it work I left the localhost binding and added an additional binding for *. This must be done in the ~ProjectFolder~/.vs/config/applicationhost.config and not in the old location of Documents/IISExpress.....
The corrected binding looks like this in my case:
<bindings>
<binding protocol="http" bindingInformation="*:4355:localhost" />
<binding protocol="http" bindingInformation="*:4355:*" />
</bindings>
I've Solution with multiple Projects in my Visual Studio Professional 2013 (Update 2).
I wish to start two of them by multiple startup project option:
Web Forms application which hosts silverlight application
WCF Service
I'm using IIS Express and Internet Explorer for browsing.
Everything was working but suddenly from one day I've stared getting this error at startup:
"Process with an Id of 7612 is not running."
Than IIS Express is closing (not icon tray) and in my output :
The program '[4956] iisexpress.exe' has exited with code 0 (0x0).
The program '[7612] iisexpress.exe' has exited with code 0 (0x0).
It seemed to my like Visual Studio was unable to invoke IIS Express. I have tried to invoke it by myself with command to run all my two sites:
"C:\Program Files\IIS Express\iisexpress.exe"
/apppool:Clr4IntegratedAppPool
And they run correctly. Now when IIS Express is already up, I'm running again my projects from Visual Studio correctly. But it's very inconvenient for me because if I stop debugging I must reopen my IIS Express again...
Could You drop me a hint what's wrong ? Should I install normal IIS and try with him ?
Here's my applicationhost.config:
<sites>
<site name="IDReader.WCF" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\Dokumenty\IT\PracaMagisterska\IDReader\IDReaderWCF" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:4267:localhost" />
</bindings>
</site>
<site name="IDReader.Web" id="4">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\Dokumenty\IT\PracaMagisterska\IDReader\IDReader.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:5066:localhost" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
I have a Visual Studio web application project that, for certain reasons, copies files from multiple projects to a separate output directory. I want to use this output directory as the root of the associated IIS Express site. In IIS Express' applicationhost.config file, I can set the associated site's physical path to the correct directory. I'll set it like this:
<site name="MySiteName" id="42">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="c:\my\desired\path" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:63470:localhost" />
</bindings>
</site>
However, when I reopen the project, Visual Studio overwrites my specified physical path, reverting it to the project's own directory. Even worse, Visual Studio gives me no indication that it has done this. Here's how the <virtualDirectory> element looks after Visual Studio messes it up:
<virtualDirectory path="/" physicalPath="c:\path\to\project" />
How can I prevent Visual Studio from overwriting this path?
Visual Studio 2013 and 2015 does not change the physical path for the option 'Override applicationpool URL':
The file %userprofile%\documents\iisexpress\config\applicationhost.config looks like the following as default:
<site name="MyWebSite" id="1477659296">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\MyWebSite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:62238:localhost" />
<binding protocol="http" bindingInformation="*:62238:*" />
</bindings>
</site>
Just copy the your default block above, paste it directly below and make some changes. Change the name, id, physicalPath and override the URL with the additional subdomain. In my case debug:
<site name="MyWebSiteOverwritten" id="99999999">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\DifferentPath" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:62238:debug.localhost" />
</bindings>
</site>
Now, when I start VS and run the IIS Express, Visual studio does not change the physicalPath in the applicationhost.config of the overwritten URL. That works for me.
Hint for Visual Studio 2015: Visual Studio 2015 uses the file YourProject/.vs/config/applicationhost.config and overrides it every time you open the environment. Open your *.proj file and set the following entry:
<UseGlobalApplicationHostFile>true</UseGlobalApplicationHostFile>
With this configuration, the IIS Express uses your global application host file located at: %userprofile%\documents\iisexpress\config\applicationhost.config.
I wasn't able to prevent VS to override the physicalPath for MySiteName but as a workaround I added another application section with different path (lets say "NewPath") and didn't update VS to use this path under the csproj web properties. In this case when debugging it will automatically open the browser on the old url (http://localhost:63470/) if you navigate to the new endpoint (http://localhost:63470/NewPath) everything will work fine and VS will not revert this.
So the new configuration looks like this:
<site name="MySiteName" id="42">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="c:\path\to\project" />
</application>
<application path="/NewPath" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="c:\my\desired\path" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:63470:localhost" />
</bindings>
</site>
I modified the default application host file to enable remote connection to my IISExpress. As I learned here, I modified the bindings as follows:
<sites>
<site name="Development Web Site" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_BIN%\AppServer\empty_wwwroot" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:*" />
</bindings>
</site>
<sites>
When starting the service, I get this:
C:\Program Files\IIS Express>iisexpress /path:c:\iis\ /port:80
Copied template config file
'C:\Program Files\IIS Express\AppServer\applicationhost.config'
to 'C:\DOCUME~1\test\LOCALS~1\Temp\iisexpress\applicationhost201311513534137.config'
Updated configuration file 'C:\DOCUME~1\test\LOCALS~1\Temp\iisexpress\applicationhost201311513534137.config' with given cmd line info.
Starting IIS Express ...
Successfully registered URL "http://localhost:80/" for site "Development Web Site" application "/"
Registration completed IIS Express is running. Enter 'Q' to stop IIS Express
And in the actual config file I have this:
<site name="Development Web Site" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="c:\iis\" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
</bindings>
</site>
As the server is bound to localhost, I can't access it remotely.
How can I force the setting to take effect?
Solution: use the /config switch and assign a specific config file so it won't copy the default file and doesn't modify it uncontrollably.