Simple WebService + IIS

Posted on 2013-01-23
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 = "")]
[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 

    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.
Question by:toddinho
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2

Expert Comment

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.
LVL 25

Expert Comment

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.

Expert Comment

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.
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

LVL 25

Expert Comment

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.
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 38810840
Try using aspnet_regiis command to register .net modules.
For details check the article

Author Comment

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

Author Comment

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"
LVL 10

Expert Comment

by:Monica P
ID: 38813200

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?
LVL 10

Accepted Solution

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\\framework\v2.0.50727\aspnet_regiis.exe -i
LVL 19

Expert Comment

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

Author Comment

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"...

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

751 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