Link to home
Create AccountLog in
Avatar of mdreed
mdreedFlag for United States of America

asked on

Cannot access web service.

I have built and tested a web service using Localhost, and I have successfully published the service to another machine that is the IIS machine.  That is, the publish function in VS 2008 completed successfully and the files were correctly moved to the web server machine.

Now, if I attempt to access the web service (called 'service') with the string:
http://<ip addr of IIS machine>/Service.asmx
the following error occurs: (attached image) User generated image
Avatar of bcolladay
bcolladay
Flag of United States of America image

First try and run the web service from the local machine if you have access.  That may give you a descriptive error that will help you.  Otherwise to see the error on the machine you are currently accessing it from, follow the instructions in the error to edit the web.config file on the web server/folder you published to.

If you have trouble with that error or don't understand it, post that error.
Avatar of mdreed

ASKER

I tried running it on the web server, where the service was published to, and get the error shown in the attached image. User generated image
Check in IIS and make sure that the .Net framework Version is the same as the one you developed for.  Under IIS get the properties for the website and go to the ASP.NET tab Make sure that the ASP.NET version is what you developed under.
Avatar of mdreed

ASKER

I saw from the bottom of the error display that it was referencing .NET Framework 1.1 so I installed 3.5, but the error persists.

I am now uninstalling IIS and reinstalling to see if that corrects the error.  Is there a certain sequence that these components must be installed?
Hmmmm...don't know sounds possible I wouldn't think an IIS reinstall should be needed.  Maybe a server re-start at most.
Avatar of mdreed

ASKER

Also, when I went to the ASP.NET tab as you suggested, 3.5 wasn't even listed, even though I had installed it.
You have to register the framework to IIS, did it just have 1.1?
Avatar of mdreed

ASKER

The dropdown list showed 1.1 and 2.0 but not 3.5.  How do I force it to use 3.5?
If I have to register it, how do I do that?
On your server, browse to \WINDOWS\Microsoft.NET\Framework
 in each version folder you should be able to find aspnet.regiis.exe

from a cmd window you will run

\microsoft.NET\Framework\--version--\aspnet_regiis.exe -i
If 2.0 is listed just choose that, 3.5 is an extension of 2 so it should work, there is no aspnet_iis.exe for 3.5 but there is for 4.0 if you developed using 3.5 choose 2.0xx
Just to clarify: if you developed under the 3.5 framework, choose 2.0.50727 as your AS.Net framework on the ASP.NET tab in IIS Website properties.
Avatar of mdreed

ASKER

I have reinstalled IIS; rebooted the web server; changed the ASP.NET tab to select .NET Framework 2.0; and registered 2.0.
Now, when I publish the app to the web server from my dev machine the publish fails (doesn't say why).
And if I just copy the asmx file, etc to wwwroot on the web server, it now says that the web page cannot be found, instead of throwing the error I mentioned before.
This is REALLY frustrating.
Ok, I never use the publish feature, not that it is good or bad, I just have no experience with it.  What version of windows server is your IIS server 2003, 2008?

How complicated is your webservice?

Does it access a network database?

How many files, what sub folders, files are in your project folder?
Avatar of mdreed

ASKER

The web server is XP.
The web service does access a DB on a different machine.
The Project tree is attached. User generated image
Supposing Windows Server 2003:

Copy your project folder and contents to the server drive, for arguments sake let's say c:\mywebservice

Start IIS
On the left pane open the server tree
expand the "web sites" folder tree
if there are other sites installed, (not likely since you re-installed IIS) right click and stop them.
Right-click on the "web sites: folder icon and choose "New---Web Site
Follow the wizard:
Name your Webservice something
IP Address and ports are probably the default unless you know differently.
Browse to the folder you copied your project directory to earlier - choose the folder that contains your .asmx file
Web site permissions - default "read"
Now your site will appear in the Web Site - Tree
Right click-Properties on your website
ASP.NET tab make sure 2.0.x is chose.
Documents Tab: add yourfile.asmx to the list and move it to the top delete others.

That should do it.  you can even right clik your asmx file in the right pane and "Browse" to see if it works.





Okay so the above instructions will work.

when copying files, copy The app_code, app_data service.asmx and web.config to the director on the IIS machine
Avatar of mdreed

ASKER

If I right-click 'web sites' I do not show what you describe.  See attached.
ServiceError2.jpg
Ok, so on XP the default one is already there...
hold on....
ASKER CERTIFIED SOLUTION
Avatar of bcolladay
bcolladay
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of mdreed

ASKER

It's magic !  All is well with the world.

So when you create a new service, you just copy the 'build' structure to the web server an point to it ?

If I want to create a new web site, so that I don't have to use the 'Default Web Site', how do I do that?
Yes!

Basically.

Well the restrictions on XP IIS are that you can only have one site.  Also you can only have one concurrent connection to the server at a time.
if you have additional web services you need to run, you can add to your existing asmx file and have more than one routine on that web service.
Avatar of mdreed

ASKER

Thanks for all your help.