Solved

Simple WebService + IIS

Posted on 2013-01-23
11
269 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
[X]
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
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

617 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