从 Visual Studio 2017 使用 OData 服务

Consume OData Service from Visual Studio 2017(从 Visual Studio 2017 使用 OData 服务)

本文介绍了从 Visual Studio 2017 使用 OData 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Dynamics Nav OData 时遇到问题.我正在使用 Visual Studio Community 2017(版本 15.9.0),并且我已经安装了扩展 OData 连接服务(官方 Microsoft 扩展)

这是我的 Odata 结构:

<块引用>

到目前为止,一切正常.

问题是当我去 Visual Studio 并尝试添加新的连接服务时,它会引发下一个错误

图片文字:

<块引用>

连接服务无法访问

对我来说效果很好.

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.

This is my Odata structure:

http://myWeb:8145/DynamicsNav90_Desa/OData

I've verified and the odata is returning 2 values correctly at opera browser.

So far, it's working fine.

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:

Image text:

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.

解决方案

I had the same issue (I'm also working with Dynamics Nav ;) )

The problem is that OData Connected Service doesn't support authorization.

You need to save metadata file locally and point it when adding OData Service Reference.

  1. Open http://myWeb:8145/DynamicsNav90_Desa/OData/$metadata in the browser and save it on disk
  2. Use path to this file during adding service reference in Visual Studio:

For me it works perfectly.

这篇关于从 Visual Studio 2017 使用 OData 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:从 Visual Studio 2017 使用 OData 服务

基础教程推荐