IIS Express 10 Configuration Resets - windows

I am having an annoying problem with IIS Express v10 using Windows 10, and Visual Studio Enterprise 2015.
Basically our web applications we must have bound to allow remote connections through host names. This is easy to achieve we simply set the configuration as an example below.
<site name="WebApplication" id="26">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\WebApps\WebApplication" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:44371:*" />
</bindings>
</site>
This configuration always worked in previous IIS Express instances. The issue I am facing is everytime I restart the workstation IIS will create another instance of the web application bindings however will be defaulted again to only allow localhost as listed below. (Note it also adds (1+) to the name).
<site name="WebApplication(1)" id="28">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\WebApps\WebApplication" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:44371:localhost" />
</bindings>
</site>
This has only started happening since using Visual Studio 2015 and IIS Express 10. Now daily I just go and reset each of the web applications (we have about 5-6) bindings back to allow remote connections.
Now somewhere I seen this issue arise when having the option Apply server settings to all users (store in project file) selected. However on all my applications have ensured these are all unchecked.
Additionally I run Visual Studio as Administrator using the Run As Administrator option selected on the short cut properties. I also have UAC disabled (as I hate those prompts).
Any help would be appreciated.
Cheers, Nico.

I have been able to find a resolution (which appears to be more of a workaround) but anyway to resolve this I was able to just to add another binding to initial site configuration to allow remote connections. Basically adding
<binding protocol="http" bindingInformation="*:44371:*" />
To my existing binding such as below
<site name="WebApplication(1)" id="28">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\WebApps\WebApplication" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:44371:localhost" />
<binding protocol="http" bindingInformation="*:44371:*" />
</bindings>
</site>
Was able to resolve this. Now again it feels like a work around as actually the initial binding is duplicated.

Related

VS 2017 .NET Core IISExpress setting up multiple applications to run under same host site

Ive searched all over for an answer to this - Prior to converting some of my applications to .NET Core I could do the below config in applicationhost.config for IISExpress so when I hit F5 in Visual Studio all the applications (in different solutions) started up in ISSExpress and any Web api calls etc.. between applications would work (e.g. api1 could talk to api2)
<sites>
<site name="test" id="1" serverAutoStart="true">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\codepath" />
</application>
<application path="/api1" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\codepath\api1" />
</application>
<application path="/api2" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\codepath\api2" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
</bindings>
</site>
<!-- other settings relevant to your installation of IISExpress-->
</sites>
I cant get this to work when they are .NET Core apps - I think it maybe because It does not seem to allow two .NET Core apps to share the same applicationPool - On F5 it will automatically create a new applicationPool and update the config accordingly. When I look at IIS Express in the tray it has only started up the current application.
Does anyone know how to get round this? or create the same effect when dealing with .NET Core apps? - At the moment I have to run multiple solutions at the same time and It really slows down local debugging for anything that interacts with other applications
Any help would be appreciated

Visual studio update behind a proxy server

I'm using Visual studio 2015 inside our organization. I want to be able to use the Extensions and updates features but I always get a connection problem when I try to access the "online" or "update" section. We are behind a proxy server.
The problem is related to the configuration of the proxy because the feature work well if I connect my pc on a direct internet connection.
The proxy is managed by another organization and I don't know much about that subject.
I need help on what I should say so they understand what they need to change.
Does someone knows what configuration need to be put in place to make that VS feature works?
thanks
Assuming you're working on Windows, you can try to set the Proxy for VS in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe.config
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress="http://proxy.bn.ch:8080" />
</defaultProxy>
</system.net>
This overrules the standard Proxy Settings from IE.
the answer of tk78 is correct but if you are behind a company proxy probably you need to add user, password and domain on the proxy address like this:
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress="http://domain%5Cusername:password#youproxyaddress:portnumber" />
</defaultProxy>
</system.net>
The '%5C' is the escape for '' .

Basic Authentication on IIS Express

I've searched for a while now but I can't seem to find the answer. There are ways of disabling/enabling anonymous and windows authentication. Does anyone know how to enable basic authentication on IIS Express (8.0) in Visual Studio 2013?
Update ApplicationHost.config
In the the ApplicationHost.config file, find the following nodes and update the values:
<sectionGroup name="authentication"&gt
<basicAuthentication enabled="false" /> <!-- set to false -->
</sectionGroup&gt
<!-- ... -->
<authentication&gt
<section name="basicAuthentication" overrideModeDefault="Allow" /> <!-- set to allow -->
</authentication&gt
Locate ApplicationHost.config
VS 2015 and above (per Joost's answer):
sln_folder/.vs/applicationhost.config
VS 2013 and below:
%UserProfile%\Documents\IISExpress\config\applicationhost.config
As far as I know, there is no way to enable it for only one project.
An additional heads up, in Visual Studio 2015, the location of the applicationhost.config file that is actually being used is inside a folder called .vs inside your solution folder. The one in your user profile is not being used
Here are slightly more details than the previous answer had:
%USERPROFILE%\Documents\IISExpress\config\applicationhost.config:
<basicAuthentication enabled="true" />
In the same file: set
<anonymousAuthentication enabled="false" userName="" />
If you are not using domain test accounts, create a local user account with the password for the test login.

IIS Express Windows Authentication

I'm trying to use IIS Express with VS2010 to host a silverlight application. I modified my applicationhost.config file to allow for modification of the proper configuration settings. I have the following in my web.config:
<location path="">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>
I am not being authenticated and my domain service call returns a null record as the user. I was able to get this to work after installing VS2010 SP1 BETA but I'm trying to get this to work with only IIS Express.
How do I enable Windows Authentication to work with IIS Express. Is there a configuration setting that I am missing?
Visual Studio 2010 SP1 and 2012 added support for IIS Express eliminating the need to edit angle brackets.
If you haven't already, right-click a web-flavored project and select "Use IIS Express...".
Once complete, select the web project and press F4 to focus the Properties panel.
Set the "Windows Authentication" property to Enabled, and the "Anonymous Authentication" property to Disabled.
I believe this solution is superior to the vikomall's options.
Option #1 is a global change for all IIS Express sites.
Option #2 leaves development cruft in the web.config.
Further, it will probably lead to an error when deployed to IIS 7.5 unless you follow the "unlock" procedure on your IIS server's applicationHost.config.
The UI-based solution above uses site-specific location elements in IIS Express's applicationHost.config leaving the app untouched.
More information here:
http://msdn.microsoft.com/en-us/magazine/hh288080.aspx
option-1:
edit \My Documents\IISExpress\config\applicationhost.config file and enable windowsAuthentication, i.e:
<system.webServer>
...
<security>
...
<authentication>
<windowsAuthentication enabled="true" />
</authentication>
...
</security>
...
</system.webServer>
option-2:
Unlock windowsAuthentication section in \My Documents\IISExpress\config\applicationhost.config as follows
<add name="WindowsAuthenticationModule" lockItem="false" />
Alter override settings for the required authentication types to 'Allow'
<sectionGroup name="security">
...
<sectionGroup name="system.webServer">
...
<sectionGroup name="authentication">
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
...
<section name="windowsAuthentication" overrideModeDefault="Allow" />
</sectionGroup>
</sectionGroup>
Add following in the application's web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</configuration>
Below link may help:
http://learn.iis.net/page.aspx/376/delegating-configuration-to-webconfig-files/
After installing VS 2010 SP1 applying option 1 + 2 may be required to get windows authentication working. In addition, you may need to set anonymous authentication to false in IIS Express applicationhost.config:
<authentication>
<anonymousAuthentication enabled="false" userName="" />
for VS2015, the IIS Express applicationhost config file may be located here:
$(solutionDir)\.vs\config\applicationhost.config
and the <UseGlobalApplicationHostFile> option in the project file selects the default or solution-specific config file.
Building upon the answer from booij boy, check if you checked the "windows authentication" feature in
Control Panel -> Programs -> Turn windows features on or of -> Internet Information Services -> World Wide Web Services -> Security
Also, there seems to be a big difference when using firefox or internet explorer.
After enabeling the "windows authentication" it works for me but only in IE.
In addition to these great answers, in the context of an IISExpress dev environment, and in order to thwart the infamous "system.web/identity#impersonate" error, you can simply ensure the following setting is in place in your applicationhost.config file.
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
This will allow you more flexibility during development and testing, though be sure you understand the implications of using this setting in a production environment before doing so.
Helpful Posts:
http://forums.iis.net/post/1873372.aspx
http://www.iis.net/learn/application-frameworks/building-and-running-aspnet-applications/aspnet-20-breaking-changes-on-iis
In IIS Manager click on your site.
You need to be "in feature view" (rather than "content view")
In the IIS section of "feature view" choose the so-called feature "authentication"
and doulbe click it.
Here you can enable Windows Authentication.
This is also possible (by i think in one of the suggestions in the thread) by a setting in the web.config ( ...)
But maybe you have a web.config you do not want to scrue too much around with.
Then this thread wouldnt be too much help, which is why i added this answer.
This answer may help if: 1) your site used to work with Windows authentication before upgrading to Visual Studio 2015 and 2) and your site is attempting to load /login.aspx (even though there is no such file on your site).
Add the following two lines to the appSettingssection of your site's Web.config.
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false"/>
On the same note - VS 2015, .vs\config\applicationhost.config not visible or not available.
By default .vs folder is hidden (at least in my case).
If you are not able to find the .vs folder, follow the below steps.
Right click on the Solution folder
select 'Properties'
In Attributes section, click Hidden check box(default unchecked),
then click the 'Apply' button
It will show up confirmation window 'Apply changes to this folder, subfolder and files' option selected, hit 'Ok'.
Repeat step 1 to 5, except on step 3, this time you need to uncheck the 'Hidden' option that you checked previously.
Now should be able to see .vs folder.
After doing everything in the above answers, I figured out I was not running Visual Studio as Admin. After running as Admin, problem solved.
If none of the answers helps, you might need to adjust the project properties. Check this other StackOverflow answer on how to do that:
https://stackoverflow.com/a/20857049/56621
I'm using visual studio 2019 develop against ASP.Net application. Here's what been worked for us:
Open your Project Property Windows, Disable Anonymous Authentication and Enable Windows Authentication
In your Web.Config under system.web
<authentication mode="Windows"></authentication>p
And I didn't change application.config in iis express.

IIS Express - Visual Studio - Running multiple sites on the same port

I have multiple APIs that use the same port (8888). These APIs are part of different solutions.
http://localhost:8888/api1
http://localhost:8888/api2
....
When I run any of the APIs in visual studio 2013 (hit F5), iis express starts and all of the APIs are running. This happens even though the APIs are part of different solution. I can see them when I click on the iis express icon under View Sites.
I installed VS 2015 and when I run one API in visual studio the other APIs do not run. I cannot even run the other APIs in the other solution since I get:
unable to launch iis express.. port is in use
how can I get the other APIs to run when I run any API? I need to mimic the behavior that exists in VS 2013 in VS 2015.
Thanks.
I solved this for a similar scenario, although in my case I chose to run IISExpress via the command line and passed through the config file as an argument.
Edit the applicationhost.config file. I found mine via the folder path %USERPROFILE%\Documents\IISExpress\config
Locate the <sites> section (found under <system.applicationHost>)
As an example, I have two applications that I want to host simultaneously on port 80 on localhost:
<sites>
<site name="test" id="1" serverAutoStart="true">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\codepath" />
</application>
<application path="/api1" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\codepath\api1" />
</application>
<application path="/api2" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\codepath\api2" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:localhost" />
</bindings>
</site>
<!-- other settings relevant to your installation of IISExpress-->
</sites>
The key things I had to do to get this working was:
Make sure applicationhost.config is well-formed XML
Make sure you specify the root path in addition to the two api application paths
serverAutoStart="true" ensures the site starts when IISExpress is called
All the applications share the same applicationPool
I defined just one site and bundled in all my applications as sub paths
Update to this in Visual Studio 15+ the IIS config folder is in the projects hidden .vs folder [ProjectFolder]/.vs/[ProjectName]/config/applicationhost.config
Other than that, Ivor's Answer still worked for me.
If you do want the old behavior, use global application host file in your project file please,
<UseGlobalApplicationHostFile>True</UseGlobalApplicationHostFile>
http://blog.majcica.com/2018/03/15/using-global-application-host-file-in-visual-studio-2015/

Resources