Solved

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

Posted on 2008-10-27
3
906 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now