Visual Studio uses IIS express
I want server to load data on start not on first http request.
Settings are located in [solutiondir].vs\config
If I paste those attributes and then run by F5:
serviceAutoStartEnabled="true" serviceAutoStartProvider="ApplicationPreload"
xml
<site name="DesignHubSite" id="4" serverAutoStart="true">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" serviceAutoStartEnabled="true" serviceAutoStartProvider="ApplicationPreload" physicalPath="C:\Users\user\Documents\GitHubVisualStudio\DesignHub\DesignHubSite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:54520:localhost" />
</bindings>
</site>
I get this error:
Error occurs "Process with Id of 6864 is not running"
The problem is that serviceAutoStartEnabled and serviceAutoStartProvider are attributes of the <application /> element not <virtualDirectory />.
You can verify this by running:
iisexpress.exe /config:[path_to_applicationhost.config] /siteid:[site_id_in_applicationhost.config]
You'll see an error similar to the following:
Filename: \\?\[path_to_applicationhost.config]
Line number: [line_number]
Error: Unrecognized attribute 'serviceAutoStartEnabled'
I found solution
in application pool i have set startMode="AlwaysRunning" for worker 'Clr4IntegratedAppPool'
other changes are not requiered
now it works as intended
Related
I have a project on TFS, I have two solutions under two differents folders :
Project>.NET>projectwebhr
Project>.NETprojectwebfinance
When I try to load the first project it is loaded without errors.
At the same time, I want to load the second project by opening it in Visual Studio but I get the following error :
I already followed these steps but in vain.
When I check the config file, I find the following :
<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>
<site name="projectwebhr" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\XXX\projectwebhr\projectwebhr" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:2101: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>
But cannot find the sitename for the second folder
You can try to add the site of the second folder to the <sites> node in the config file.
I ended up removing Sync from the IISExpress folder like below :
According to other SO questions the problem has been solved by editing the hosts file and applicationhost file. These two files are already properly setup on my machine. This error started ocurrring right after I upgraded to visual studio 2015 SP1
http://bdtest.localhost:50119/ returns bad request
Hosts File -
localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 bdtest.localhost
application hosts file
<site name="BizDox.Web" id="2">
<application path="/" applicationPool="Clr4ClassicAppPool">
<virtualDirectory path="/" physicalPath="C:\Source\BizDox\Summer2015-Navigation\BizDox.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:50119:*"/>
<binding protocol="http" bindingInformation="*:50119:localhost" />
<binding protocol="http" bindingInformation="*:50119:bdtest.localhost" />
<binding protocol="http" bindingInformation="*:50119:demo.localhost" />
<binding protocol="http" bindingInformation="*:50119:diy.localhost" />
<binding protocol="http" bindingInformation="*:50119:akuity.localhost" />
<binding protocol="http" bindingInformation="*:50119:owlsfactory.localhost" />
<binding protocol="http" bindingInformation="*:50119:rtp.localhost" />
<binding protocol="http" bindingInformation="*:50119:barebones.localhost" />
<binding protocol="http" bindingInformation="*:50119:sygnet.localhost" />
<binding protocol="http" bindingInformation="*:50119:firstsolution.localhost" />
</bindings>
</site>
What else could cause a 400 error if your host files are properly setup?
I am running VS2015 as admin.
VS 2015 changes the default applicationhost.config file located in mydocuments/iisexpress to be a project specific applicationhost.config file. You can find this in your web project under a hidden .vs folder.
Your two options are to either open this folder and edit the applicatoinhost.config file or to tell the .proj file to use the default config file located in documents/iisexpress. You simply have to alter/add this line to the .proj file.
<UseGlobalApplicationHostFile>true</UseGlobalApplicationHostFile>
Add this to the top of the file inside the <PropertyGroup> tag
Make sure to close VS and re-open it for changes to take effect. Also make sure to run as administrator.
I have attempted to get IIS Express working so that external users can view my MVC ASP.NET development website. I followed instructions on this SO answer but am now getting a 503 error when accessing the website using my external IP address, localhost still works fine.
My configuration file seems ok
<site name="ManagerUI" id="5">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\Application Development\Manager\MAIN-Branch\ManagerUI\ManagerUI" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:1904:" />
</bindings>
</site>
I found the following SO answer which solves the issue, but it will ONLY allow it to work on an external address rather than all my IP addresses (localhost, external one etc)
<binding protocol="http" bindingInformation=":1904:your-machine-name" />
I managed to solve it, my mistake was thinking that you could only have one binding set, I then setup binding for every external address I wished to serve on and it now all works
<bindings>
<binding protocol="http" bindingInformation=":1904:" />
<binding protocol="http" bindingInformation=":1904:machineName" />
<binding protocol="http" bindingInformation=":1904:10.1.10.123" />
</bindings>
I've been examining the event logs for the WebApp I'm trying to automatically deploy and the only problem I can find is this (Azure event log):
An unhandled exception occurred. Type: System.IO.DirectoryNotFoundException Process ID: 1784
Process Name: WaIISHost
Thread ID: 1
AppDomain Unhandled Exception for role Website_IN_0
Exception: Could not find a part of the path 'E:\approot'.
So I have a poke and sure enough, nothing lives there and the directory doesn't even exist. However I then realise the site exists in E:\sitesroot.... so why is it looking in approot?
This is my service definition:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="WebsiteAzure" xmlns="etc">
<WebRole name="Website" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WebRole>
</ServiceDefinition>
Is that right?
For the record the deployment works fine with visual studio but i'm trying to automate with powershell which is where I'm getting the issue. I'm pretty sure it has all the .dlls it requires and the config and definition are correct so why is it choking on this directory?
I would suggest using New-AzureServiceProject and add-azure*webrole to scaffold the project locally, and using Publish-AzureServiceProject to package and publish to Azure.
I have two ASP.Net MVC applications, let's say Site1 and Site2.
For now, I can successfully access Site1 by visiting http://localhost/
Here's my IIS Express applicationhost.config file:
<sites>
<site name="Site1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_USER_HOME%\wwwroot\Site1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
<binding protocol="http" bindingInformation=":80:10.49.0.137" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\logs\tracelogfiles" enabled="false" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="IISExpressAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
What I want now is:
Access Site1 on http://localhost/Site1
Place Site2 on %IIS_USER_HOME%\wwwroot\Site2
Access Site2 on http.//localhost/Site2
How should I change the above applicationhost.config to achieve what I want?
Thanks.
change your applicationhost.config as shown below and restart IIS Express.
<sites>
<site name="Site1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_USER_HOME%\wwwroot\" />
</application>
<application path="/site1">
<virtualDirectory path="/" physicalPath="%IIS_USER_HOME%\wwwroot\Site1" />
</application>
<application path="/site2">
<virtualDirectory path="/" physicalPath="%IIS_USER_HOME%\wwwroot\Site2" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
<binding protocol="http" bindingInformation=":80:10.49.0.137" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\logs\tracelogfiles" enabled="false" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="IISExpressAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
Check this great entry.
Working with SSL at Development Time is easier with IISExpress - Scott Hanselman
Execute netsh command after applicationHost.config append binding.
netsh http add urlacl url=http://10.49.0.137:80/ user=everyone