7

I just wrote a sample code for ASP.NET Web Application, using web service. The environment is Visual Studio 2015. My operation system is Windows 8.

When doing debug, the webpage would not show the app from URLs. Rather it reports an error:

"

Server Error in '/' Application.

Access is denied. Description: An error occurred while accessing the resources required to serve this request. You might not have permission to view the requested resources.

Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to 'K:...\WebServicesDemo\WebServicesDemo\CalculatorWebService.asmx'.

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248

"

What have I tried:

gave access to "IIS_IUser" but instead it should be "IUSR". That solved the problem. This comes from post: Hosting ASP.NET in IIS7 gives Access is denied?

I noticed there are some solutions offered, but none of them makes sense to me. Could anyone give me a step by step answer?

For example, I don't understand where to add IIS_IUSRS or IUSR. what are they any way? Second, it seems that neither IIS_IUSRS nor IUSR is recognized in my security folder (right click app folder, property-> security tab)

For more information, my Web.config looks like:

<?xml version="1.0"?> 
<!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> 
<configuration> 
<system.web> 
<compilation debug="true" targetFramework="4.0"/> 
<httpRuntime/>
 </system.web>
 </configuration> 
Community
  • 1
  • 1
Curly
  • 539
  • 2
  • 7
  • 14
  • Can show `` section of your web.config file? – vendettamit Jul 17 '15 at 20:20
  • Edit the question to add more details not in the comments. Other might not be able to get the whole thing while reading your question. – vendettamit Jul 17 '15 at 20:33
  • Go to `properties` of your project by pressing `F4` and see the if `Anonymous` user is `enabled`. If not then enable it and try again. – vendettamit Jul 17 '15 at 20:34
  • properties, as right clicking the project folder, choosing properties under windows; or go to solution explorer at VS and right click and choose properties? – Curly Jul 17 '15 at 20:57
  • 1
    ASMX is a legacy technology, and should not be used for new development. WCF or ASP.NET Web API should be used for all new development of web service clients and servers. One hint: Microsoft has retired the [ASMX Forum](http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/threads) on MSDN. – John Saunders Jul 17 '15 at 22:10
  • @JohnSaunders Good catch. – vendettamit Jul 17 '15 at 23:41
  • So what's the solution then? It will never work out? thx – Curly Jul 20 '15 at 13:04

2 Answers2

20
  1. Navigate to the root of your web application : e.g. C:\Inetpub\wwwroot[Website folder name]
  2. Right click on the file and go to "Properties > Security"
  3. Click "Edit" and then click "Add"
  4. Click "Advanced" in the bottom left
  5. Click "Find Now" - this should list all the accounts available
  6. Scroll till you find "IUSR" and select it
  7. Click "OK"
  8. Click "OK" again
  9. In the block "Permissions for IUSR" click on "allow" next to "Full Control"
  10. Click apply (wait for the dialog to close)
  11. Click "OK"
  12. Click "OK" again

your problem should be solved

Chad
  • 368
  • 4
  • 13
13

In addition tho Chad's answer, there is a tricky setting you may have to check as well:

1) Open the Root Web Site in IIS

2) Go to Authentication --> Anonymous Authentication --> Edit

3) Make sure Anonymous user identity is set to Application pool identity

However, if you want to use a specific user account for anonymous authentication that differs from the application pool account, you will have to grant this account access to the web application folder as well.

Thomas C. G. de Vilhena
  • 13,819
  • 3
  • 50
  • 44
  • Yes! This comment saved me. I was scratching my head trying to figure out why I could not create a new site in IIS to run an .asmx web service – Jonathan May 23 '23 at 13:39