Link to home
Start Free TrialLog in
Avatar of novknow
novknow

asked on

Web Service (C#)

I have no problem when developing and testing  one web service using C# 2.0 on XP running IIS.
But I encounter following error on Win Server 2003 running IIS 6:

http://homepage/WebService/Service.asmx
...
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
...

What is missing here?
Need help to get this to run.


Avatar of boy8964
boy8964

is "homepage" your server's name?
Is ASP.NET 2.0 registered on the server?

To do this (after installing 2.0 Framework) go to the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 folder and run Aspnet_regiis -i

Is IIS configured to serve aspx and asmx pages? Unrecognized MIME types will result in a 404 error.
Avatar of novknow

ASKER

Hi boy8964,
Yes, homepage is the server name.

Hi Nightman,
Sorry, I am not familiar with IIS and need to get this done quickly - how to configure IIS to serve aspx and asmx pages?

Have you installed the .NET 2.0 Framework?
Have you already run aspnet_regiis -i ?
Avatar of novknow

ASKER

Hi Nightman,

Yes. I have rebooted the server as well but still same error.

Can you browse to an html page in that path?

e.g.
http://homepage/WebService/test.html (you will obviously have to create a test page)
Avatar of novknow

ASKER

Yes.
Does the ASPNET user account have access to that folder on disk? Often permission errors are simply returned as 404 file not found by IIS.
Also, this might require the NETWORKSERVICE account to have access. It depends on how IIS is configured.
Avatar of novknow

ASKER

Hi Nightman,
I have tried both ASPNET user and NETWORKSERVICE account and still the error.
Do I need to reboot the server again?
How can I verify if I have set the permission correctly?
You shouldn't need to reboot the server.
To verify that the permissions are correctly set, right click on the folder and ensure that ASPNET user and NETWORKSERVICE accounts have access to the folder.

Is the site set up as a virtual directory/web site in IIS, or have you simply copied the folder on to disk?
Avatar of novknow

ASKER

I think I have set the permission correctly.

I have first tried to create sub-web through Server Extension 2002.
Then I deleted the sub-web and let Visual Studio create it for me but both methods have the same error:

http://homepage is only used for publishing smart client (click once) application previously.

When I create the website from ASP.Net Web Service using C#, I indicate the new location as
http://homepage/WebService and the folder was created.

OK, so was it created just as a folder on disk, or as a proper application (virtual directory)?

To check this, right click on the folder in IIS, select properties. If it is already a virtual directory, there will be a virtual directory tab at the top. If not, click on the tab 'home directory'

If it has been set up correctly, there will an Application Name roughly in the middle of the form, with a button 'Remove' next to it. If not, the text box will be greyed out and the button will say 'Create'.

Let me know what it looks like.
Avatar of novknow

ASKER

I right click on the folder "WebService" in IIS, select properties, there are six tabs in the windows:
Directory
Documents
Directory Security
HTTP Headers
Custom Errors
ASP.NET

There aren't any 'virtual directory' or 'home directory'.
Then it is simply a folder. Go to 'Directory' and click the 'Create' button (make sure the application name is 'WebService'). Click apply, and see if that resolves it.
Avatar of novknow

ASKER

There is no 'Create' button.
May I know which 'Directory' are you refering to?
The directory tab that you listed in your last post. Right click on the folder in IIS, select properties --> select the directory tab and and then click 'Create'.
Avatar of novknow

ASKER

The directory tab has only "Remove", "Configuration..." and "Unload" button.

There is a "orange color gear" beside this folder name "WebService". It is not the same as the rest.
Any difference here?
If the remove button is already there, it is a virtual directory / application already.

In the combo box below the application name and the Remove button (Execute Permissions), what is it set to? If 'none' change to scripts only or scripts and executables.

If you select the 'Web Sites' node in the tree and click properties, home directory and then configuration, it will open to a tab 'mappings'. Is the .asmx document type there?
Avatar of novknow

ASKER

Hi Nightman, thanks for your response.

Both scripts only and scripts and executables did not work.
I tried remove and re-create, stop and re-start the service did not work.
Yes, the .asmx document type is there.

Should I delete "WebService" and re-create from VS?

ASKER CERTIFIED SOLUTION
Avatar of Nightman
Nightman
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm sure you've done this already, but on the ASP.NET tab in properties, does it have the right version of ASP selected for the webservice?

If the webservice is 2.0, make sure you have the 2.0 version selected in the dropdown box.
nevermind,.... just re-read your question and the error message is different. If the version was wrong, you'd get a configuration error.
Avatar of Kyle Abrahams, PMP
in order to see it correctly


in IIS:
under websites:

right click on webservice -> properties

you need to create the application in the virtual directory tab.   (EG: click "create" . ..  it should open up to this directly)

can you view

http://homepage/WebService/Service.asmx from the server directly?  (eg: hit http://localhost/webservice/service.asmx from the server.  Do you still get 404?)

Avatar of novknow

ASKER

Hi guys, thanks for all the helps.
I finally found the solution:
Under the node : Web Service Extensions, change ASP.NET v2.0.50727 to "Allowed".
Thanks once again
regards