locked
can't view table data using ado.net data services RRS feed

  • Question

  • Hi,

    I am VS2008 SP1. I have a ADO.NET data service(WebDataService.svc), created against an ADO.NET entity model (EmployeeModel.edmx). The entity model has only one table(Employee) in it. Physical database is an mdf file part of the same asp.net project.

    When I browse the service with the following URL http://localhost:2835/WebDataService3.svc/ through IE6 browser following XML is output.

      <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
    - <service xml:base="http://localhost:2835/WebDataService3.svc/" 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="Employee">
      <atom:title>Employee</atom:title>
      </collection>
      </workspace>
      </service>

    But When I try to access 'Employee' table through the following URL http://localhost:2835/WebDataService3.svc/Employee() browser tries to download a file which fails with the error message "Internet Explorer cannot download Employee() from localhost".

    I also tried to use this service in my silverlight client project. When I tried to query Employee table an exception is thrown at "query.EndExecute()". Examining the inner exception I got the following message:

    "<html>\r\n    <head>\r\n        <title>The resource cannot be found.</title>\r\n        <style>\r\n         body {font-family:\"Verdana\";font-weight:normal;font-size: .7em;color:black;} \r\n         p {font-family:\"Verdana\";font-weight:normal;color:black;margin-top: -5px}\r\n         b {font-family:\"Verdana\";font-weight:bold;color:black;margin-top: -5px}\r\n         H1 { font-family:\"Verdana\";font-weight:normal;font-size:18pt;color:red }\r\n         H2 { font-family:\"Verdana\";font-weight:normal;font-size:14pt;color:maroon }\r\n         pre {font-family:\"Lucida Console\";font-size: .9em}\r\n         .marker {font-weight: bold; color: black;text-decoration: none;}\r\n         .version {color: gray;}\r\n         .error {margin-bottom: 10px;}\r\n         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }\r\n        </style>\r\n    </head>\r\n\r\n    <body bgcolor=\"white\">\r\n\r\n            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>\r\n\r\n            <h2> <i>The resource cannot be found.</i> </h2></span>\r\n\r\n            <font face=\"Arial, Helvetica, Geneva, SunSans-Regular, sans-serif \">\r\n\r\n            <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.\r\n            <br><br>\r\n\r\n            <b> Requested URL: </b>/Webservice3.svc/Employee()<br><br>\r\n\r\n            <hr width=100% size=1 color=silver>\r\n\r\n            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053\r\n\r\n            </font>\r\n\r\n    </body>\r\n</html>\r\n<!-- \r\n[EndpointNotFoundException]: The service '/Webservice3.svc' does not exist.\r\n   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)\r\n   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)\r\n   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()\r\n   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()\r\n[HttpException]: The service '/Webservice3.svc' does not exist.\r\n   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)\r\n   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)\r\n   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext)\r\n   at System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context)\r\n   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)\r\n-->"


    I did not find any reference to this problem in the web. Kindly let me know how to solve this issue.

    Thanks in advance.
    Thursday, May 28, 2009 9:00 AM

Answers

  • hi grrakesh

    it seems that you have renamed the file WebService3.svc to WebDataService3.svc, when you do that you must make sure that you change the markup on the svc file to reflect the class name change.


    Daniel Portella - http://undocnet.blogspot.com - http://twitter.co/dmportella - This posting is provided "AS IS" with no warranties, and confers no rights. If this post has answered your question please mark as the answer and if it is helpful do like wise.
    • Edited by Daniel Portella Thursday, May 28, 2009 2:04 PM change info from web.config to markup as data services uses a factory and not the web.config
    • Marked as answer by Shayne Burgess - MSFTModerator Sunday, August 9, 2009 5:37 AM
    Thursday, May 28, 2009 9:11 AM

All replies

  • hi grrakesh

    it seems that you have renamed the file WebService3.svc to WebDataService3.svc, when you do that you must make sure that you change the markup on the svc file to reflect the class name change.


    Daniel Portella - http://undocnet.blogspot.com - http://twitter.co/dmportella - This posting is provided "AS IS" with no warranties, and confers no rights. If this post has answered your question please mark as the answer and if it is helpful do like wise.
    • Edited by Daniel Portella Thursday, May 28, 2009 2:04 PM change info from web.config to markup as data services uses a factory and not the web.config
    • Marked as answer by Shayne Burgess - MSFTModerator Sunday, August 9, 2009 5:37 AM
    Thursday, May 28, 2009 9:11 AM
  • A few more suggestions to go along with Daniel's
     a) ""Internet Explorer cannot download Employee() from localhost"
     this suggests that you are usinng IE 6 , IE 6 cannot understand the Byte Order Mark we place as the first 2 bytes of our response.
     this is expected behavior.

    b)
    [EndpointNotFoundException]: The service '/Webservice3.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()\r\n

    the above stack trace suggests that the URI you are using to access the data service is incorrect.
    Can you share the code for your Silverlight app where you do the BeginExecute ?
    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Thursday, May 28, 2009 4:10 PM
    Moderator