Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VS 2010 not allowing me to create reference to my Web Service

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
US
I had this working before but had to delete it as I wanted to change the reference name (which was the default: localhost)

So I deleted that reference and tried to create another.

But now it won't create it. I get an error message before it goes to the

Here is the .asmx file:

<%@ WebService Language="C#" CodeBehind="SpearASCData.asmx.cs" Class="SpearASCWebService.SpearASCData" %>

the first part of the .asmx.cs file is:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using DataLayer;

namespace SpearASCWebService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "[URL unfurl="true"]http://tempuri.org/")[/URL]]
    [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 SpearASCData : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

I do the add Service/advanced/Add Web Service/ and go to web services in this solution. My service shows up (so it sees it) and I get the following error message in the left panel.

Code:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not create type 'SpearASCWebService.SpearASCData'.

Source Error: 

Line 1:  <%@ WebService Language="C#" CodeBehind="SpearASCData.asmx.cs" Class="SpearASCWebService.SpearASCData" %>

Source File: /SpearASCData.asmx    Line: 1 

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

In the right panel I get:

Code:
There was an error downloading '[URL unfurl="true"]http://localhost:49920/SpearASCData.asmx'.[/URL]
The request failed with the error message:
--
<html>
    <head>
        <title>Parser Error</title>
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {fo

What is causing this?

It worked fine before and I haven't changed any code.

Thanks,

Tom
 
Figured it out.

I had to Clean my service solution and web solution to get it to work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top