使用Visual Studio 2017中的OData服务 [英] Consume OData Service from Visual Studio 2017
问题描述
我在使用Dynamics Nav OData时遇到问题.我正在使用Visual Studio Community 2017(15.9.0版),并且已安装扩展OData Connected Service(Microsoft官方扩展)
I've a issue consuming Dynamics Nav OData. I'm using Visual Studio Community 2017 (version 15.9.0), and I've installed the extension OData Connected Service (Official Microsoft Extension)1.
这是我的Odata结构:
This is my Odata structure:
我已经验证,并且odata在Opera浏览器中正确返回了 2 值
I've verified and the odata is returning 2 values correctly at opera browser.
到目前为止,一切正常.
So far, it's working fine.
问题是当我进入Visual Studio并尝试添加新的连接服务时,它将引发下一个错误 3 :
The problem is when I go to the visual studio and I try to add a new connected service, It throws the next error 3:
图片文字:
连接的服务 无法访问 http://myWeb:8145/DynamicsNav90_Desa/OData/ $ metadata
Connected Services Cannot access http://myWeb:8145/DynamicsNav90_Desa/OData/$metadata
我已经检查了防火墙和端口信息,它们完全可以连接.
I've checked the firewall and the port information and they are totally open to connect.
推荐答案
我遇到了同样的问题(我也在使用Dynamics Nav;))
I had the same issue (I'm also working with Dynamics Nav ;) )
问题在于OData Connected Service不支持授权.
The problem is that OData Connected Service doesn't support authorization.
您需要在本地保存元数据文件,并在添加OData服务参考时将其指向.
You need to save metadata file locally and point it when adding OData Service Reference.
- 在浏览器中打开 http://myWeb:8145/DynamicsNav90_Desa/OData/ $ metadata并将其保存在磁盘上
- 在Visual Studio中添加服务引用期间使用此文件的路径:
- Open http://myWeb:8145/DynamicsNav90_Desa/OData/$metadata in the browser and save it on disk
- Use path to this file during adding service reference in Visual Studio:
对我来说,它工作得很好.
For me it works perfectly.
这篇关于使用Visual Studio 2017中的OData服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!