Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Create c# web service - "Web Access Failed" - HELP!!


Message #1 by "Norman" <norman_lm_fung@h...> on Sat, 20 Apr 2002 16:45:08
HELP! I have tried everything I know! Cant get it working! Cant create a 
web project with VS.NET IDE!!? Keep getting "web access failed" and 
the "Help" wasnt very helpful!

Jeff's solution resolved the problem, but after a while (not sure what's 
been changed...) we've the exact problem again. The following posting is 
separated into four parts:

a. MY first posting about this problem.
b. FEEDBACK 1
c. FEEDBACK 2 from Jeff.
d. MY response to FEEDBACK 2

Please specifically refer to <QUESTION 1> and <QUESTION 2>... Those are 
the problems that I have yet to resolved.


************************************************
(a) MY first posting:
I am having problem creating ASP.NET web service projects. 

IIS 5.0 is installed on this WIN2000 Adv Server. Visual Studio.NET of 
course.

I created a virtual directory and configured basic authentication. Then:

ATTEMPT 1:
(1) new project>c#>ASP.net service>
(2) Browse for the project directory. But virtual directory does not 
appear in the "Project Location" dialog box.
    Only "real" directory can be found in the dialog.
(3) Having no other option, I selected one of the "real" directory for my 
the project location.
    The directory is C:\Inetpub\wwwroot\ASP Projects\
    Before this, I configured sharing for "C:\Inetpub\wwwroot\ASP 
Projects\" and "Everyone" has read/write access to this directory.
(4) After clicking "Open" in the "Project Location" dialog box, I return 
to "New Project" dialog box.
    At this point, the "name" edit box AND "OK" button are greyed out.

ATTEMPT 2:
(1) new project>c#>ASP.net service>
(2) In "New Project" dialog box, I accept the default setting:

	"name" edit box = "WebService1"    .... This edit box was greyed 
out!
	"location" edit box = http://localhost/WebService1
(3) Clicked "OK" on "New Project" dialog box.
(4) Visual Studio.net attempt to create the project... Then error msg:

	"Web Access Failed"

	 The default access mode set to this project is set to file share, 
but the project folder at 'http://localhost/WebService1' cannot be opened 
with path 'c:\inetpub\wwwroot\WebService1'.
 	 The error returned was:

		Unable to create Web project 'WebService1'. The file 
path 'c\inetpub\wwwroot\WebService1' does not correspond to 
URL 'http://localhost/WebService1'. The two need to map to the same server 
location. HTTP Error 500: Server Error.

(5) Then I have two options:

	"What would u like to do?"

	"Retry using a different file share path..."
	"Try to open the project with FrontPage Server Extension"

Both attempt to create the project failed! Help!



Here're the feedback I had:


***************************************************************************
(b) FEEDBACK 1:

Maybe you installed Win2K without IIS (IIS is an option you can
turn off, but usually by default it is installed). Anyhow, I don't know
what MS Frontpage does to IIS. I guess there is only one way to find
out, by just uninstalling Frontpage, then reinstalling IIS (Add/Remove
Programs-->Windows Components), then repairing VS.NET (use the repair
option available at the installation of VS.NET). But that will be a lot
of work and time.

<MY COMMENT: No, I've installed VS.NET on Windows Advance Server. And by 
default, IIS is installed.>

You can set the IIS root as followed: 
1. Start/Control Panel/Administrative Tools/Internet Information Services. 

2. Then open up the tree branch to Internet Information 
Services/YOURCOMPUTERNAME (local
computer)/Web Sites/Default Web Site. 
3. Right click on Default Web Site
4. and choose Properties. 
5. Click on the Home Directory tab, and you can set
the root in the "Local Path" textbox--it's usually defaulted to
c:\inetpub\wwwroot. <MY COMMENT: Okay, I left the default as default. No 
change to this.>
6. Try giving more people rights to that folder (start
with the VS Developers user account, yourself and also the ASPNET
(aspnet_wp) account. 
<MY COMMENT: No, I now authorize annonymous "Administrator" access. Even 
this failed to rectify the "web access failed" problem"
..>

The error message you are getting basically says that the
virtual directory needs to map to the physical directory in which the
solution file (the .sln) file resides. However, when you let VS.NET
create the directory, it should do all this work for you. The only way
to mess up the mapping that I can think of is to manually change the
"Local Path" of the virtual directory AFTER you have set up the project
already. 
<MY COMMENT: No, didnt manually change the local path>

That's why I encourage you to try out complete new names, not
just "WebService1" which might have already been created for you the
last time you tried. Or alternatively, try manually deleting both the
virtual and the physical directory.
<MY COMMENT: No, I used a lot of weird names... cant rectify the problem.>


***************************************************************************
(c) FEEDBACK 2 from Jeff:

BUG: ASP.NET Does Not Work with the Default ASPNET Account on a Domain 
Controller (Q315158)

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q315158


After you install Microsoft Visual Studio .NET or the Microsoft .NET 
Framework on a domain controller, if you try to run an ASP.NET 
application, the browser displays the following error message: 

Server Application Unavailable 

The web application you are attempting to access on this web server is 
currently unavailable. 

Please hit the "Refresh" button in your web browser to retry your request. 
Furthermore, the following event is logged in the system application event 
log: 
aspnet_wp.exe could not be launched because the username and/or password 
supplied in the processModel section of the config file are invalid. 
aspnet_wp.exe could not be started. 
HRESULT for the failure: 80004005 
This applies to Internet Information Services (IIS) version 5.0 or later. 


CAUSE
By default, ASP.NET runs its worker process (Aspnet_wp.exe) with a weak 
account (the local machine account, which is named ASPNET) to provide a 
more secure environment. On a domain controller, all user accounts are 
domain accounts and are not local machine accounts. Therefore, 
Aspnet_wp.exe fails to start because it cannot find a local account 
named "localmachinename\ASPNET". To provide a valid user account on the 
domain controller, you must specify an explicit account in the 
<processModel> section of the Machine.config file, or you must use the 
SYSTEM account. 

NOTE : If you try to debug (click the start button) before trying to 
browse to the page you can experience the exact same problem. 



RESOLUTION
To work around this problem, use one of the following methods: 

Create a weak account that has the correct permissions, and then configure 
the <processModel> section of the Machine.config file to use that account. 


Set the userName attribute to SYSTEM in the <processModel> section of the 
Machine.config file. 


Configure the <processModel> section of the Machine.config file to use an 
administrator account. 

<QUESTION 1>

Should I:

<processModel enable="true" timeout="Infinite" ..... 
userName="MY_COMPUTER_NAME\Administrator" password="1234567" .... 
maxWorkerThreads="25" maxIoThreads="25"/>

OR 

<processModel enable="true" timeout="Infinite" ..... 
userName="Administrator" password="1234567" .... maxWorkerThreads="25" 
maxIoThreads="25"/>

Please pay attention to user name. One (the first) qualify user with the 
computer name in front. The later simply use the user name.

Anyway, for some reason, both does not work!?!

</QUESTION 1>

NOTE : Allowing ASP.NET applications to run as SYSTEM or an administrator 
account has serious security implications. If you use either of these 
workarounds, code that is run in the Aspnet_wp.exe process will have 
access to the domain controller and the domain settings. Executable files 
that are started from the Aspnet_wp.exe process run in the same context 
and also have access to the domain controller. 

Therefore, Microsoft recommends that you use the first workaround. To use 
the first workaround, follow these steps: 
Create a user account on the computer named ASPUSER, and then add this 
account to the Users group. 

NOTE : You can also use the ASPNET account that the .NET Framework created 
if you change the password on this account. You must know the password on 
this account because you add the password to the <processModel> section 
later in these steps. 


Grant the ASPUSER or the ASPNET account the Log on as a batch job user 
right. Make sure that this change appears in the Local Security Policy 
settings. 

NOTE : To grant the Log on as a batch job user right on this account, you 
may have to grant this user right in each of the following security 
policies: 


Domain Controller Security Policy 
Domain Security Policy 
Local Security Policy 

NOTE : You may have to reboot the server for these changes to take effect. 


Make sure that the ASPUSER or the ASPNET account has permission to access 
all of the necessary directories and files to start the Aspnet_wp.exe 
process and to serve the ASP.NET pages. 

For additional information about what permissions you must grant to this 
account, click the article number below to view the article in the 
Microsoft Knowledge Base: 
Q317012 INFO: Process and Request Identity in ASP.NET 
Open the Machine.config file. 


In the <processModel> section of the Machine.config file, change the 
userName and the password attributes to the name and the password of the 
account that you created in step 1. For example: 


userName="DomainName\ASPUSER" password="ASPUSERpassword"
Save the changes to the Machine.config file. 


STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed 
at the beginning of this article. 

REFERENCES
For additional information about ASP.NET security, click the article 
number below to view the article in the Microsoft Knowledge Base: 

Q306590 INFO: ASP.NET Security Overview 



***************************************************************************
(d) MY RESPONSE TO FEEDBACK 2:

<QUESTION 2>

Hi Jeff, I ran into the same problem again!

I edited Machine.config:

<processModel enable="true" ....userName="dev" 
password="1234567" ...maxWorkerThreads="25" maxIoThreads="25"/> 

Like I said, i workED. But after sometime (not sure if it's after reboot), 
I had the same problem again!?


Quote "Did you install this on a Domain Controller?"
I can find it installed under:
Add/Remove Programs>Windows Component Wizard>Networking Services>DNS

One observation:

The first time when it worked after i edited Machine.config as you 
recommended, when I tried to create a new "ASP.net web services" project, 
an IIS authentication pop-up appeared requesting login and passwd. 

Then, after sometime (i dunno if there's a reboot..) it stopped working. 
No IIS pop up requesting credentials.. Web Access failed! Same message! I 
checked Machine.config again. It's the after-edit version. It worked 
before but...

I hope reinstalling VS.net is not the only option left. Or worse, 
reinstalling OS.

Norman

</QUESTOIN 2>

Thanx!

  Return to Index