开发者

Cannot get data out of a WCF Data Service

I set up a WCF Data Service http://localhost:65432/YeagerTechWcfService.svc and when I run it, I get the expected output below:

<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<service xmlns="http://www.w3.org/2007/app" xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xml:base="http://localhost:65432/YeagerTechWcfService.svc/"> 
   <workspace> 
       <atom:title>Default</atom:title> 
       <collection href="Categories"> 
          <atom:title>Categories</atom:title> 
       </collection> 
       <collection href="Customers"> 
           <atom:title>Customers</atom:title> 
       </collection> 
       <collection href="Priorities"> 
           <atom:title>Priorities</atom:title> 
       </collection> 
       <collection href="Projects"> 
           <atom:title>Projects</atom:title> 
       </collection> 
       <collection href="Status"> 
           <atom:title>Status</atom:title> 
       </collection> 
       <collection href="TimeTrackings"> 
           <atom:title>TimeTrackings</atom:title> 
       </collection>
    </workspace> 
</service>

However, after executing the below method, I'm getting a js runtime error in the script: httpErrorPagesScripts.js when testing开发者_如何学Python it out via the browser:

var bElement = document.createElement("A");
bElement.innerText = L_GOBACK_TEXT ;
bElement.href = "javascript:history.back();";
goBackContainer.appendChild(bElement); 

The method that is executing is below after I put in the following query:

http://localhost:65432/YeagerTechWcfService.svc/Customers


public QueryOperationResponse<Customer> GetCustomers()
{
        YeagerTechEntities DbContext = new YeagerTechEntities();

        YeagerTechModel.YeagerTechEntities db = new YeagerTechModel.YeagerTechEntities();

        DataServiceQuery<Customer> query = (DataServiceQuery<Customer>)
                from customer in db.Customers
                    where customer.CustomerID > 0
                    select customer;

        QueryOperationResponse<Customer> items = (QueryOperationResponse<Customer>)query.Execute();

        db.Dispose();

        return items;
    }

Even if I set a breakpoint in the above method, it doesn't stop there. I just know that after I submit the query on the address bar, it goes into this method, and then pops out and executes that js error. I'm sure that I'm missing something..... Can someone help?

There is only 1 record coming back from the database, so the number of rows fetched is not an issue...

Note that this same type of query is successfully executed against an EF ORM model with a regular WCF Application Service. It's just that when I try to apply the same query using a WCF Data Service, I'm getting the error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜