locked
Meta data error when access ADO.NET Data service RRS feed

  • Question

  • The solution include following project:
    1. MyData: NorthwindModel.edmx  generated using entity frame work template

    2. MyService: myService.svc, ADO.NET Data Service generate from template.
    The initial access for this service is set as:

    public static void InitializeService(IDataServiceConfiguration config)
    {   
                config.SetEntitySetAccessRule("*", EntitySetRights.All);
                config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
                config.UseVerboseErrors = true;  
    }

    In this project, there is a policy file clientaccesspolicy.xml. The content is:
    <?xml version="1.0" encoding="utf-8" ?>
    <access-policy>
      <cross-domain-access>
        <policy>
          <allow-from http-request-headers="*">
            <domain uri="*"/>
          </allow-from>
          <grant-to>
            <resource include-subpaths="true" path="/"/>
          </grant-to>
        </policy>
      </cross-domain-access>
    </access-policy>

    3. MyClient: Silverlight project:
    4. MyWeb: Web site to hold the silverlight application.


    All the codes and files are generated in VS 2008 by tools or template. Then I tried to add ADO.NET Data Service(in project MyService) reference in project MyClient. Using discovery, I can find out the service in the list. But when I click on OK button and try to add reference, I got following error:

    There was an error downloading 'http://localhost:49370/myService.svc'.
    The request failed with HTTP status 400: Bad Request.
    Metadata contains a reference that cannot be resolved: 'http://localhost:49370/myService.svc'.
    The remote server returned an unexpected response: (400) Bad Request.
    The remote server returned an error: (400) Bad Request.
    If the service is defined in the current solution, try building the solution and adding the service reference again.


    I also add a WCF service in MyService project, and I can add service reference for this WCF service.

    Why I can't service reference for ADO.NET Service across domain even I have set the across domian policy file clientaccesspolicy.xml?

    Help please.


    Saturday, March 7, 2009 10:22 PM

Answers

All replies

  • Hi Kent,
     Can you try and access http://localhost:49370/myService.svc/$metadata and see if that works ?
     I think that the service is not Initializing the metadata for some reasons.
    You can follow the instructions on this blog post to debug your data service :
     Debugging Ado.net Data Services


    Phani Raj Astoria
    • Marked as answer by KentZhou Tuesday, March 10, 2009 12:46 AM
    Monday, March 9, 2009 5:31 PM
    Moderator
  • Hi Phani, Thanks for your info. Find out reason:
    When generating EDM, VS 2008 will put the data connection string in app.config file in the library project. But in fact, as a library project, it's don't need this config file.
    In Service project, should get that connection string and put it in web.config file for this service project.
    The it works.
    Thanks again.
    Tuesday, March 10, 2009 12:45 AM