OpenAccess Service works locally but not hosted

4 posts, 0 answers
  1. Tony
    Tony avatar
    7 posts
    Member since:
    Nov 2012

    Posted 23 Nov 2012 Link to this post

    I have 3 projects, one with the entity model, another one with the OData v3 service generated from the entity model, the third one is an asp.net web application.

    During local development the service reference I added into the web app is from same solution: http://localhost:55001/MyModelService.svc

    After everything was successfully tested I then published the service project and hosted it on a third party hosting service. I was able to browse the service successfully by going: http://service.myapp.com/MyService.svc

    I then re-added the existing service reference into my web app with the remote url shown above, published the web app on another hosting service.

    When I load up the web app I got an error:
    DataServiceQueryException was unhandled by user code
    An error occurred while processing this request.

    Is there any settings that I have missed or anything else I am doing wrong?

    thanks in advance
  2. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 23 Nov 2012 Link to this post

    Hello Tony,

    Can you provide more details about the exception that your client code experiences?
    A lot of things can cause an exception.
    You can include exception details in the response sent to the client by applying the following attribute to the data service class:
    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]

    You also can check if you are in cross-domain scenario and missed to set up the policies properly.

    All the best,
    Viktor Zhivkov
    the Telerik team
    Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
  3. DevCraft banner
  4. Tony
    Tony avatar
    7 posts
    Member since:
    Nov 2012

    Posted 23 Nov 2012 Link to this post

    hi Viktor

    thanks for your quick response. I had a look at the inner exception, it says:
    [System.Data.Services.Client.DataServiceClientException] 
    "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"><code></code><message xml:lang=\"en-US\">An error occurred while processing this request.</message></error>"

    I will look into the cross-domain scenario now

    cheers
  5. Tony
    Tony avatar
    7 posts
    Member since:
    Nov 2012

    Posted 23 Nov 2012 Link to this post

    hi Viktor

    After I added the  clientaccesspolicy.xml the issue seems fixed when debugging.

    I will test further and hopefully it is the real fix

    thanks again
Back to Top