Solved

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

Posted on 2008-10-27
3
924 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
[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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

752 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