Solved

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

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

785 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