Solved

Simple WebService + IIS

Posted on 2013-01-23
11
265 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

832 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