从 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 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)