Solved

Adding Web Service asmx page to existing asp.net web application not working

Posted on 2008-10-27
3
920 Views
Last Modified: 2008-10-27
I want to add a web service interface to an existing ASP.NET web application.  In Visual Studio 2005, I added the Web Service template to the main web application http project which added the asmx page shown below.  When I try to run the asmx page, it just displays the contents of the file in the browser; it does not run it as a web service.  Why is it doing this?  I am able to add web services outside of an existing web application; I am having trouble just adding an asmx page to my existing asp.net web application.

Any ideas?
<%@ WebService Language="C#" Class="Test2" %>
 
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
 
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Test2  : System.Web.Services.WebService {
 
    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }
    
}

Open in new window

0
Comment
Question by:StewartMeyers
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Solar_Flare earned 500 total points
ID: 22818495
does your web.config file have the http handlers for .asmx files?


eg
<remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
0
 

Author Comment

by:StewartMeyers
ID: 22818684
Thanks for the response.

It did not have the handler; I did add it, but it did not make a difference.  Interestingly, if I use Visual Studio to build a Web Service project, it does not add the asmx handler to the web.config file.  In my case though, I need to add web service support to an existing asp.net application.
0
 

Author Comment

by:StewartMeyers
ID: 22819067
Actually, adding the handler did fix the problem.  IE didn't recognize the change until I refreshed even though I clicked on the asmx page in 'View in Browser' in Visual Studio.  Thanks much.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Save ms data to server side. 19 58
asp.net uploading picture to a temporary folder 4 25
Record locking on classic ASP 3 35
CSS for Popup in ASP.NET 4 10
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…
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…
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…

680 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