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.
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 :
I have two web roles within a cloud service, one to expose outside and one for internal use. The external web role has an MVC web application which will have to connect to the internal web role which will have a Web API. I have the below service definition for my Azure Cloud service.
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureWeb_ExternalCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="ExternalWebApplication" vmsize="A6">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
<Setting name="ServiceBaseURL" />
</ConfigurationSettings>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
</WebRole>
<WebRole name="InternalWebAPI" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint2" endpointName="Endpoint2" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Endpoints>
<InternalEndpoint name="Endpoint2" protocol="http" port="8080" />
</Endpoints>
</WebRole>
<NetworkTrafficRules>
<OnlyAllowTrafficTo>
<Destinations>
<RoleEndpoint roleName="InternalWebAPI" endpointName="Endpoint2"/>
</Destinations>
<WhenSource matches="AnyRule">
<FromRole roleName="ExternalWebApplication"/>
</WhenSource>
<AllowAllTraffic/>
</OnlyAllowTrafficTo>
</NetworkTrafficRules>
</ServiceDefinition>
However, I get the below error when I try to build.
The XML specification is not valid: The element 'OnlyAllowTrafficTo'
in namespace
'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition'
has invalid child element 'AllowAllTraffic' in namespace
'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition'
According to the ServiceDefinitionSchema (mine is located at %ProgramFiles%\Microsoft SDKs\Azure.NET SDK\v2.8\schemas), the AllowAllTraffic element must precede the WhenSource element.
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
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 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