Search code examples
jqueryjsonsharepoint-2010url-rewritingsvc

Accessing listdata.svc via URL Rewrite redirect to SharePoint 2010


I am hitting a proxy server with URL rewrite rules rewriting the URL's to access a Sharepoint server. Everything works except I get a 404 on /_vti_bin/listdata.svc. I also get an error on the proxy server in the app log.

Log Name: Application

Source: System.ServiceModel 4.0.0.0

Date: 1/3/2013 12:49:20 PM

Event ID: 3

Task Category: WebHost

Level: Error

Keywords: Classic

User: IIS APPPOOL\HrSelfService

Computer: webnet01test.bluebunny.com

Description:

WebHost failed to process a request. Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/9460241 Exception: System.Web.HttpException (0x80004005): The service '/_vti_bin/listdata.svc' does not exist. ---> System.ServiceModel.EndpointNotFoundException: The service '/_vti_bin/listdata.svc' does not exist. at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)

I am populating menu headers from a sharepoint list...

So the page would be domain2.com/pages/default.aspx and the below code would execute and populate a menu on the page.

Thanks for any help you can give.


$.ajax({ url: "http://Domain1.com/_vti_bin/listdata.svc/MegaMenuCategories?$orderby=OrderingValue%20asc",

        dataType: 'json',
        crossDomain:true, 
        async: false,
        success: function (data) {
        var menuLength = data.d.results.length;
        for (i=0; i<data.d.results.length; i++){
            var results1 = data.d.results[i].MenuTitle;
            var order = data.d.results[i].OrderingValue;

            if (order == "1")
                addMenuTitle(order, results1);   

            if (order == "2")
                addMenuTitle(order, results1);

            if (order == "3")
                addMenuTitle(order, results1);

            if (order == "4")
                addMenuTitle(order, results1);

            if (order == "5")
                addMenuTitle(order, results1);

            if (order == "6")
                addMenuTitle(order, results1);
        }
        if (menuLength == "5"){
            $("#megaRtCorner").css("left","490px");
            $("#megaMenu").css("width","475px");
        }
       }
    });</code>

Solution

  • I worked with Microsoft on this issue and figured out if you request the listdata.svc service from SharePoint through a URL Rewrite proxy the request will die at the proxy. What happens is the proxy server tries to handle the request and obviously returns a 404.

    What we had to do was remove the handler mapping in IIS so the service request would flow through the proxy to the SharePoint server.

    We removed the svc-Integrated-4.0 on the specific IIS website.

    We tested SharePoint and everything is working great and we now have access to _vti_bin/listdata.svc through URL Rewrite.