1 Replies - 1558 Views - Last Post: 18 August 2009 - 10:32 PM Rate Topic: -----

#1 venkateshps  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 45
  • Joined: 24-March 09

Getting error when opening webservice in IE

Post icon  Posted 17 August 2009 - 12:38 AM

Hi,
I have written a simple web service.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace FirstService
{
	/// <summary>
	/// Summary description for Service1
	/// </summary>
	[WebService(Namespace = "http://localhost/MyWebServices/")]
	[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
	[System.ComponentModel.ToolboxItem(false)]
	// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
	// [System.Web.Script.Services.ScriptService]
	public class Service1 : System.Web.Services.WebService
	{

		[WebMethod]
		public int Add(int a, int b)
		{
			return a + b;
		}

		[WebMethod]
		public String SayHello()
		{
			return "Hello World";
		}

	}
}




but when i try opening "http://localhost/MyWebServices/Service1.asmx" url in IE i get following error, c:\MyWebServices is the IIS virtual directory i have created.

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

A name was started with an invalid character. Error processing resource 'http://localhost/MyWebServices/Service1.asmx'. Li...

<%@ WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="FirstService.Service1" %>
-^



Thanks,
venkateshps

Is This A Good Question/Topic? 0
  • +

Replies To: Getting error when opening webservice in IE

#2 W3bDev  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 42
  • View blog
  • Posts: 379
  • Joined: 15-March 09

Re: Getting error when opening webservice in IE

Posted 18 August 2009 - 10:32 PM

Probably your internet explorer settings! Go to internet options > security, then look for "access data sources across domains", and enable this option.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1