views:

12

answers:

1

I'm not sure what's causing this error.

The service markup:

<%@ ServiceHost 
    Language="C#" 
    Debug="true" 
    Service="WebRole1.ExpenseService" 
    CodeBehind="ExpenseService.svc.cs"
    Factory="System.ServiceModel.Activation.WebServiceHostFactory"
%>

The service code behind:

[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ExpenseService
{
    [OperationContract]
    [WebGet(UriTemplate="expenses", ResponseFormat=WebMessageFormat.Xml)]
    public List<ExpenseInfo> GetExpenses()
    {
        List<ExpenseInfo> result = new List<ExpenseInfo>();
        // ...

        return result;
    }
}

If I run the project and navigate to the service on the browser, the data shows up fine.

If I try to add the service http://localhost:88/ExpenseService.svc/expenses, I get the error:

The document at the url http://localhost:88/ExpenseService.svc/expenses was not recognized as a known document type.

The error message from each known type may help you fix the problem:

  • Report from 'XML Schema' is 'The root element of a W3C XML Schema should be and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.

  • Report from 'DISCO Document' is 'Discovery document at the URL http://localhost:88/ExpenseService.svc/expenses could not be found.'.

  • The document format is not recognized.

  • Report from 'WSDL Document' is 'There is an error in XML document (1, 2).'.

    • was not expected.

Metadata contains a reference that cannot be resolved: 'http://localhost:88/ExpenseService.svc/expenses'.

The remote server returned an unexpected response: (405) Method Not Allowed.

The remote server returned an error: (405) Method Not Allowed.

If the service is defined in the current solution, try building the solution and adding the service reference again.

If I try to add a service reference to http://localhost:88/ExpenseService.svc, I get the error:

There was an error downloading 'http://localhost:88/ExpenseService.svc'. The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: 'http://localhost:88/ExpenseService.svc'. There was no endpoint listening at http://localhost:88/ExpenseService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The remote server returned an error: (404) Not Found. If the service is defined in the current solution, try building the solution and adding the service reference again.

What am I doing wrong?

Update: This page might be useful: http://code.msdn.microsoft.com/wcfazure/Wiki/View.aspx?title=KnownIssues

Update 2: I tried what was suggested on that site, with no luck.

A: 

I had originally made the reference as AJAX enabled. I deleted it and made a typical WCF one, and it seems to be working. (Although I'm still getting SecurityException issues, as detailed in another question of mine.)

Rosarch