Click to See Complete Forum and Search --> : Test web service


sweddle
January 9th, 2009, 08:26 PM
I'm trying to test a simple web service. I've copied the project folder to this folder C:\Inetpub\wwwroot. I enter this into internet explorer http://localhost/HelloWorld/Service1.asmx. HelloWorld is in the folder under C:\Inetpub\wwwroot. Service1.asmx is the web service file I'm trying to load. I'm expecting the service to be loaded and I get screen that has the button to click which represents the function inside the service which will print out "Hello World!". Instead I always get this error. I'm suprised it's so hard to test this web service. I'm thinking something is configured incorrectly, but have no idea what.
Server Error in '/' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:


Line 27: "Passport" and "None"
Line 28: -->
Line 29: <authentication mode="Windows"/>
Line 30: <!-- APPLICATION-LEVEL TRACE LOGGING
Line 31: Application-level tracing enables trace log output for every page within an application.


Source File: c:\inetpub\wwwroot\helloworld\web.config Line: 29



Show Additional Configuration Errors:


It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (c:\inetpub\wwwroot\helloworld\web.config line 43)




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

Alsvha
January 12th, 2009, 05:19 AM
pay especial attention to the line:

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (c:\inetpub\wwwroot\helloworld\web.config line 43)


because when you see that line, chances are it is the cause/fix of your problem.

Make sure the webservice is set up correct, and it is set as a virtual directory if placed under a website.
It is done in your IIS, by right clicking the website in which you want the webservice to run, and then "create new virtual directory", and then follow the instructions.

sweddle
January 14th, 2009, 08:03 PM
I followed the advice of the last post to this thread and made the directory a virtual directory in IIS. I also made a few other changes in the web.config file. Now I get the following error
Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not create type 'HelloWorld.Service1'.

Source Error:


Line 1: <%@ WebService Language="c#" Codebehind="Service1.asmx.cs" Class="HelloWorld.Service1" %>



Source File: /HelloWorld/Service1.asmx Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

samulchrist
January 19th, 2009, 12:12 AM
Create a new Web test. As soon as the browser opens, click Stop in the Web Test Editor, right-click the Web test and select Add Web Service Request, In the Url property of the new request, type the name of the Web service Open a separate session of the browser and type the URL page in the Address toolbar. Select the method that you want to test and examine the SOAP message. It contains a SOAPAction.
http://www.torontowebservices.com/

vuyiswam
January 26th, 2009, 03:02 AM
Why would you wanna test your webservice that way?

Follow the Following guideline

Step 1: Open Visual Studio and create a new Project(Website) and name it "Hello"

Step 2: Right Click on the Website in the Solution Explorer and Add a new Item and Choose "Web Service" and name it "World". You will that VS has already written you an example hello world, lets use the example as our Example

Step 3:
Add a Label to your Default.aspx page and write the Following code in your page load


World obj = new World();


String Message = obj.HelloWorld();


Label1.Text = Message;


on your web service you dont do anything. If you are using VS2005 it will be fine you dont do anything , but if you are using VS2003 , you have to go and uncomment the Function.

Hope it Helps