I've created a new MVC 5 test project in Visual Studio 2013 with authentication set to "No Authentication".
When I go to run the site in IE under Debug, I get Access Denied error.
I've confirmed the following:
-Visual Studio is running in Admin mode
-debugger is using IISExpress
-Project properties: Windows Authentication is set to 'false' and Anonymous Authentication is set to 'true
-applicationhost.config: the system.webServer subtree reflects the above:
<location path="DeleteMe">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="true" />
<windowsAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</location>
Other facts:
-I do have another MVC 5 website that does use WA. However, I don't see how this could possibly affect a completely independent project?
I've checked all related posts, and nothing is working to fix this.
Please help!
Related
I am trying out IIS authentication.
I stared by trying to deny access from all users to the Default Web Site.
appcmd set config "Default Web Site" /commit:apphost /section:system.webServer/security/authorization /+"[accessType='Deny',users='*']"
The command seems to be successful - Applied configuration changes to section "system.webServer/security/authorization" for "MACHINE/WEBROOT/APPHOST/Default Web Site" at configuration commit path "MACHINE/WEBROOT/APPHOST"
However, and when browsing http://localhost/ the Default Web Site displayed as usual. This was also the case after restring it on the IIS Manager.
What am I doing wrong \ what else should I check ?
Following is the security section in my applicationhost.config -
<location path="Default Web Site">
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
</authentication>
<authorization>
<add accessType="Deny" users="*" />
</authorization>
</security>
</system.webServer>
</location>
Thanks,
The issue was that I set the authorization in the global scope to give all users all authorization accesses. This apparently has precedence.
I want to publish a entity framework core (.Net) to a IIS.
For this I publish the application in Visual Studio Community 2017. When I publish the application the web.config file will be auto generated as the following
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\basket.api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: ba174064-1719-4e47-a0c3-5e8cff312047-->
I go to my IIS 10
I post it into the default website. Into to the location "C:\inetpub\wwwroot".
I start the web site an access via the webbrowser localhost.
I get allways the following error message:
I check the web page of Microsoft of the error code 0x8007000d,it is basicly saying that the format of a XML Element is not correct. Which is impossible I check all the formating and also I let autogenerate by the Visual Studio when i publish the site. I tried everything and don't know what to do. I am very newbie in IIS stuff.
Since a few weeks, I have some problems with Subversion. When I try to commit files from a Visual Studio 2017 project there are some files which I can't commit to my Visual SVN Server. To be precise all files in the project folder like *.cs, *.config, *.csproj, *.resx, ...
My setup:
Client: TortoiseSVN 1.9.7 on Windows10
Server: VisualSVN behind a IIS-ReverseProxy running on Windows Server 2012r2
The error I get when I try to commit for example a *.cs file:
Commit
D:\Test\branches\ScaraControl\ScaraControl\Form1.cs
D:\Test\branches\ScaraControl\ScaraControl\Form1.cs
Commit failed (details follow):
File 'D:\Test\branches\ScaraControl\ScaraControl\Form1.cs' is out of date
'/svn/Test/!svn/txr/5-9/branches/ScaraControl/ScaraControl/Form1.cs' path not found
You have to update your working copy first.
Updating the working copy is finishing successfully but doesn't fix the problem.
You can see my project in the picture below. For testing, I created a completely new and empty repository. As you can see the .vs, bin and obj folders are ignored with all the files inside of them, all other folders are committed to the server (without the files inside of them). In the second picture you can see that I can commit the *.sln file but no other file in the project folder.
For testing, I created an empty text file and renamed it to text.cs. Even this empty file cannot be committed to the Server with the same error message.
Due to the fact that this is happening to all Clients, it is more likely to be a problem on the Server side I guess but I have no idea what could cause this error. Unfortunately, the VisualSVN Server has no error logging or at least not the free version I'm using.
I would be very grateful for any tip I can get to solve this annoying problem.
Edit1: Problem is caused by the IIS Reverse-Proxy
After connecting via port 8443 directly to the VisualSVN server (bypassing the reverse proxy) everything is working again. So there must be a problem with the configuration of the URL Rewrite module. To be honest it took me quiet a long time to get it working somehow because my knowledge about all the settings is very limited.
This my Web.config with the settings for the URL Rewrite module. Maybe there is something not configured as it should be. If you need further information just ask.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="true">
<match filterByTags="A, Form, Img" pattern="^http(s)?://svn.example.org:8443/(.*)" />
<action type="Rewrite" value="http{R:1}://svn.example.org/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="ReverseProxyInboundRule1" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="{C:1}://svn.example.org:8443/{R:1}" />
</rule>
</rules>
</rewrite>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" users="" roles="Users" />
<add accessType="Allow" users="*" />
<add accessType="Allow" users="?" />
</authorization>
</security>
<urlCompression doStaticCompression="false" doDynamicCompression="false" />
<httpRedirect enabled="false" destination="https://svn.example.org" exactDestination="true" childOnly="true" />
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
I had the same issue.
The fails because IIS prohibits URL suffixes like .cs and .config
You can work around this by adding this to the web.config of the IIS proxy
<system.webServer>
<security>
<requestFiltering>
<fileExtensions allowUnlisted="true" applyToWebDAV="true">
<clear />
</fileExtensions>
<verbs allowUnlisted="true" applyToWebDAV="true" />
<hiddenSegments applyToWebDAV="true">
<clear />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
Credits to this post IIS7 and ARR as reverse proxy for Subversion
I came across the same problem and am running a reverse proxy through IIS, so believe that has something to do with it.
VisualSVN is served up locally on https://localhost:8443 and I was attempting to use the reverse proxy to route from https://svn.mysite.com. This appears to work fine. You can even checkout a fresh copy of the repo and all files are downloaded. It's when you try and commit that you have problems - as you've identified, certain files fail to be found on the repo.
The only work around I have found (thanks to your question narrowing down the likely causes) was to add the port to the URL: https://svn.mysite.com:8443. This shouldn't be necessary as the reverse proxy should handle, so I'm guessing it's an issue with VisualSVN which may be fixed in a future update.
I just upgraded my application from Visual studio 2012 to Visual studio 2013. My windows authentication is not working any more. It is giving me below error.
HTTP Error 401.2 - Unauthorized
You are not authorized to view this page due to invalid authentication headers.
In visual studio there is option to select authentication from website properties itself. So I disabled anonymous access and enable windows authentication but it is asking me for username and password as below popup. Even if I give domain credentials here. Its is still giving me this popup again and again.
Web Config :
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<identity impersonate="false" />
<trace enabled="true" />
IIS Express aspnetConfig :
<authentication>
<anonymousAuthentication enabled="false" userName="" />
<basicAuthentication enabled="false" />
<clientCertificateMappingAuthentication enabled="false" />
<digestAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="false">
</iisClientCertificateMappingAuthentication>
<windowsAuthentication enabled="true">
<providers>
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
<authorization>
<add accessType="Allow" users="*" />
</authorization>
<location path="Path">
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
<anonymousAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</location>
Let me know if you want more details on this.
Update :
I found out that if I remove below line from web.config than it start working.
<remove users="*" roles="" verbs="" />
Be careful with the applicationhost.config modifications - in Visual Studio 2015 I've found that it sometimes resides in the local project directory.
Note: The ".vs" folder is Hidden by default so you may have to select to show "Hidden Items" in Explorer to see it.
For example:
DRIVE:\MYPROJECT\.vs\config\applicationhost.config
If you're not sure which applicationhost config file is being used, you can monitor file access with ProcMon & then narrow down the results based on "Path" to see what VS is actually reading at Debug time.
Update: This appears to be the behavior in Visual Studio 2017 as well.
It looks like you solved your own question! Good on you. In addition to this post helping me I found the following to be SUPER helpful in configuring my IIS Express.
IIS Express Windows Authentication
Edit: I've copied the important information from the associated link in case it dies. This is completely from user vikomall
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="" />
In Visual Studio 2017, asp.net core project, the authentication is setup at launchSettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54491/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"TestAspNetCoreProd": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:54492"
}
}
}
For Visual Studio 2019 the applicationhost.config will be found in
DRIVE:\MYPROJECT\.vs\$(PROJECTNAME)\config\applicationhost.config
So I just discovered, in Visual Studio 2019 anyway, clicking "properties" on a web project within a solution will allow you to disable/enable Windows authentication or Anonymous authentication. These change tags within the .csproj and .sln files for IISExpressAnonymousAuthentication and IISExpressWindowsAuthentication. This is what fixed my issue.
I'm on Visual Studio 2010 and Target is 4.0. What's wrong with this web.config?
I'm getting 500 error on local web server:
The configuration section 'system.webserver' cannot be read because it is missing a section declaration
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetframework="4.0">
<authentication mode="None">
</authentication>
</compilation>
</system.web>
<system.webserver>
<modules runallmanagedmodulesforallrequests="true">
</modules>
</system.webserver>
<system.servicemodel>
<servicehostingenvironment aspnetcompatibilityenabled="true">
<standardendpoints>
<webscriptendpoint>
<standardendpoint crossdomainscriptaccessenabled="true">
</standardendpoint>
</webscriptendpoint>
</standardendpoints>
</servicehostingenvironment>
</system.servicemodel>
</configuration>
It's giving me these warnings in VS:
Warning 1 p:\jcp\WCF1\WCF1\Service1.svc: ASP.NET runtime error: Unrecognized configuration section system.webserver. (p:\jcp\WCF1\WCF1\web.config line 9) p:\jcp\WCF1\WCF1\Service1.svc 1 1 WCF1
Warning 2 The 'targetframework' attribute is not allowed. p:\jcp\WCF1\WCF1\Web.config 4 29 WCF1
Warning 3 The element 'compilation' has invalid child element 'authentication'. List of possible elements expected: 'assemblies, buildProviders, codeSubDirectories, expressionBuilders, folderLevelBuildProviders'. p:\jcp\WCF1\WCF1\Web.config 5 5 WCF1
I've set my project to use local IIS and created on virtual. My client is Windows 7 pro with iis7 and the apppool for the folder is set to 4.0. Do I need .net 3.5 installed on the client?
There are a couple of issues that I think might account for the errors you're seeing:
Web.configs are case senstive. You'll need to camel-case your text (e.g. system.webServer, targetFramework, system.serviceModel.)
system.web.authentication is a peer of system.web.compilation, and not a child of it.
i too had this for a spelling mistake, took me a couple of times to see that i missed the 'n' in environment, worth to put the entire file in a VS proj to let it test it