OData Default company and adjusting Service Config Files in Silverlight App being built in MS Visual Studio 2013

别来无恙 提交于 2019-12-08 10:23:18

问题


I'm building a Lightswitch application using MS Visual Studio 2013. As part of this I access data through an OData url (referencing a dynamics nav project) which does not seem to want to pick up the company data in the url. (It does without it). However then within Visual Studio I only see the column headers and no data. When I debug I get the following error message:

"Cannot process the request because the default Microsoft Dynamics NAV company cannot be found. You can specify a default company in the service configuration file, or specify one for each tenant, or you can add a query string in the form of "company=[name]". You can see the available companies by accessing the default OData web service, Company. For more information, see "OData Web Services" in Help."

For example: (OData url): localhost:7048/DynamicsNAV70/OData/Company('CRONUS%20International%20Ltd.')/SalesOrder

But only viewable as: localhost:7048/DynamicsNAV70/OData/ and then selecting SalesOrder

My question is, what config files are they refering to? (Visual studio?If so how do I add the company name?) "OData Web Services" in Help was of no use.


回答1:


I had to add additional code within Visual Studio to reference the company, for example:

ServiceReference1.NAV nav = new ServiceReference1.NAV(new Uri("http:...../OData/Company('company_name')/"));

nav.Credentials = new System.Net.NetworkCredential("user", "password", "domain");



来源:https://stackoverflow.com/questions/26862626/odata-default-company-and-adjusting-service-config-files-in-silverlight-app-bein

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!