Solved

Simple WebService + IIS

Posted on 2013-01-23
11
266 Views
Last Modified: 2013-03-07
Hello, I'm trying to make a very simple web service and deploying it with IIS so other machines in my network can access it. I know almost zero about web programming and can't figure out what's going wrong.

Here is my webservice code (the default):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]

public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }
    
}

Open in new window


I created it into a Folder (Web Site1). When I try to run it from VS itself I get an error "[No relevant source lines]". When I publish it to "c:\Inetpub\wwwroot" and try to access it via IIS, i get an error "You are not authorized to view this page."

Am I missing a step here?

Thanks in advance.
0
Comment
Question by:toddinho
  • 3
  • 2
  • 2
  • +2
11 Comments
 
LVL 6

Expert Comment

by:esolve
ID: 38810229
I suppose this is a web service file (.asmx)? For this to work properly it must be contained in a ASP.NET Web Application. This will not run in any other application type.

You should also ensure that IIS is setup correctly on your local machine if you're using this for testing. Also ensure that your site is configured properly.

 In order to test r-click on the asmx file and select -> view in browser. You should then see a page with the method definition or an wsdl description language.
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 38810456
The WebService technology has now been replaced by the Windows Communication Foundation (WCF).  Therefore (and I've only been learning this myself a few months) I would recommend not pursuing a WebService in the manner you are doing currently.

In VS you can start a new project, then select Templates > Visual Basic > WCF > WCF Service Application and this will give you the code you need which runs perfectly well from the VS debug button.

You can then adapt it to suite your requirements.
0
 
LVL 6

Expert Comment

by:esolve
ID: 38810481
You can still use a normal webservice. We're still using it and have been using it for the past few years without any problems.

But I would agree with Rouchie WCF does have lots more benefits.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 25

Expert Comment

by:Rouchie
ID: 38810514
Cheers @esolve

@toddinho - the main benefit is the WCF provides much better reliability with newer technologies while fully supporting older ones.  This 'just works' facility is priceless when learning as a newbie.  You will probably want to upgrade your .Net framework to 4.5 though as part of this.
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 38810840
Try using aspnet_regiis command to register .net modules.
For details check the article
http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx
0
 

Author Comment

by:toddinho
ID: 38811880
Yeah, I'm pretty sure it's a permission problem in IIS configuration... I tried the WCF Application and it ran in VS, but when I published it into IIS wwwroot folder i still couldn't visualize it...

In authentication methods I have Anonymous Access ticked and "Allow IIS to control PAssword"

Any ideas how to fix this??

PS: I'm gonna give the WCF a try since i didnt really start to delevop in web service anyway =p
0
 

Author Comment

by:toddinho
ID: 38811895
In the event logs i got the following error:

"Failed ti execute request because the App-Domain could not be created.
Error: 0x80131902"
0
 
LVL 10

Expert Comment

by:Monica P
ID: 38813200
http://forums.asp.net/t/960370.aspx

try to create new application pool for this new website

TRy to assign default page for the website

Set the directory browsing settings enabled.

Check whether page is getting opened in IIS through browse option.

Which IIS version are you using?
0
 
LVL 10

Accepted Solution

by:
Monica P earned 500 total points
ID: 38813215
Three ideas, all fairly basic.
1. Make sure you have the proper .NET frameworks installed.
2. Make sure you have your virtual directory set to the right framework.
3. Run this in the command line to make sure your IIS/.NET permissions are correct.

c:\windows\microsoft.net\framework\v2.0.50727\aspnet_regiis.exe -i
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 38813473
Have u tried my suggestion to register IIS ????
0
 

Author Comment

by:toddinho
ID: 38815917
Ok, I used the aspnet_regiis.exe -i (from every framework fodler), but i got the same error...

Im runnning IIS 5.1, VS 2010, Framework 4.0 and Windows XP...

@AkilaPalanimuthu: I checked the forum you posted, I cant find the place in IIS 5.1 to add IIS_WPG permission. Also i Tried to activate Directory Browsing woth no luck.

I actually erased the default files from IIS, I'm trying to visualize the service directly by righ-clicking it and "Browse"...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question