Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-27
3
Medium Priority
?
928 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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

688 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