Unable to add a link to my WCF data service

I have a WCF data service. I can go to it OK in my browser, and I can make requests to it successfully through the URL ... but I can’t add a service link to it, and I can’t add it to OData Explorer ... it just gives an error

The document at http: // localhost / Services / OData / Repository / was not recognized as a known document type.

When I look at my service in http://localhost/Services/OData/Repository/, I see

<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<service xml:base="http://localhost/Services/OData/Repository/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">
  <workspace>
    <atom:title>Default</atom:title>
    <collection href="Contacts">
      <atom:title>Contacts</atom:title>
    </collection>
  </workspace>
</service>

That is what I expected. And if I go to http://localhost/Services/OData/Repository/Contacts, I will return my contact results.

I suspect this is due to the way I add my OData service, but I'm not sure. I do not have svc file. Instead, I add a route to my RouteTable as follows:

RouteTable.Routes.Add(new ServiceRoute("Services/OData/Repository", 
                                       new DataServiceHostFactory(), 
                                       typeof(IMyRepository));

clientaccesspolicy.xml, , localhost...

?

.

+3
2

Windows?

,

ServiceModelReg -i

% WINDIR%\Microsoft.NET\Framework\version\Windows Communication Foundation.

0

All Articles