F#WsdlService类型提供程序代理 [英] F# WsdlService type provider proxy

查看:81
本文介绍了F#WsdlService类型提供程序代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为此处.当我在家运行它时,它可以按预期运行.当我在工作中编写相同的代码时,出现了设计时异常:

类型提供者 'Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders' 报告了一个错误:错误:无法从中获取元数据 http://msrmaps.com/TerraService2.asmx?WSDL

工作确实使用了代理,在VS2012中使用来自C#项目的WSDL时,我必须更改web.config以使用默认代理.当我查看类型提供程序的参数时,没有看到有关代理的内容.有人有建议吗?

谢谢.

解决方案

我没有通过代理进行连接,因此我无法进行实际测试,但是我认为您应该能够使用本地WSDL文件进行加载设计器中的类型提供程序.

尝试下载WSDL模式(从 http://msrmaps.com/TerraService2.asmx?WSDL)并将其保存到本地文件(例如C:\temp\terra.wsdlschema).然后您应该可以编写:

#r "System.ServiceModel.dll"
#r "FSharp.Data.TypeProviders.dll"
open Microsoft.FSharp.Data.TypeProviders

type Terra = WsdlService< ServiceUri="N/A", ForceUpdate = false, 
                          LocalSchemaFile = @"C:\temp\terra.wsdlschema">
let terra = Terra.GetTerraServiceSoap()
terra.GetPlaceList("New York", 1, false)

ServiceUri参数似乎是必需的,但是如果添加ForceUpdate=false,则应将其忽略.它只需要缓存的WSDL文件.我不完全确定如何配置运行时以使用配置文件设置,但是我敢肯定这可以通过某种方式来完成(它既可以工作,也可以将某些内容传递给GetTerraServiceSoap方法).

遗憾的是,类型提供程序无法(在设计时)静态地知道在哪里寻找配置文件,因此它会忽略它.

I am following the MSDN tutorial for the WsdlService type provider found here. When I run it at home, it works as expected. When I write the same code at work, I am getting a design time exception:

The type provider 'Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders' reported an error: Error: Cannot obtain Metadata from http://msrmaps.com/TerraService2.asmx?WSDL

Work does use a proxy and I have to alter the web.config to use a default proxy when consuming WSDL from a C# project in VS2012. When I looked at the parameters for the type provider, I don't see a mention about a proxy. Does anyone have any suggestions?

Thanks in advance.

解决方案

I'm not connecting through a proxy, so I have no way of actually testing this, but I think you should be able to use local WSDL file to load the type provider in the designer.

Try downloading the WSDL schema (from http://msrmaps.com/TerraService2.asmx?WSDL) and saving that to a local file (such as C:\temp\terra.wsdlschema). Then you should be able to write:

#r "System.ServiceModel.dll"
#r "FSharp.Data.TypeProviders.dll"
open Microsoft.FSharp.Data.TypeProviders

type Terra = WsdlService< ServiceUri="N/A", ForceUpdate = false, 
                          LocalSchemaFile = @"C:\temp\terra.wsdlschema">
let terra = Terra.GetTerraServiceSoap()
terra.GetPlaceList("New York", 1, false)

The ServiceUri parameter seems to be required, but it should be ignored if you add ForceUpdate=false. It should only require the cached WSDL file. I'm not entirely sure how to configure the runtime to use your config file setting, but I'm sure this can be done in some way (either it just works or you can pass something to the GetTerraServiceSoap method).

Sadly, the type provider does not statically know (at design time) where to look for the config file, so it ignores it.

这篇关于F#WsdlService类型提供程序代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆