问题标签 [operation-contract]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
16633 浏览

wcf - 在 WCF Web 编程模型中,如何编写带有一组查询字符串参数(即同名)的操作协定?

使用 WCF Web 编程模型,可以像这样指定操作协定:

现在,如果我们必须创建一个接受具有相同名称的参数数组的合约(在本例中为 qs1),合约就像这样......

当我们调用该方法时,我们会在运行时收到错误消息:

查询字符串必须具有具有唯一名称的“名称=值”对。请注意,名称不区分大小写。有关更多详细信息,请参阅 UriTemplate 的文档。

如何定义一个 HTTP 服务来公开具有一组参数的资源,而不使用松散的接口?

0 投票
1 回答
563 浏览

wcf - 我是否有必要在我的 WCF 服务中的每个方法上编写 [OperationContract] ?

例如,这是正确的吗?

这是 WCF ServiceContract 的有效操作体还是我必须这样做:

0 投票
2 回答
1204 浏览

c# - WCF 服务中的操作合同数量是否有限制?

我有一个包含许多操作合同的 WCF 服务。当这些操作的数量太多时,我得到一个wcftestclient绑定服务的错误。当我将此服务分成两个服务时,这个问题就解决了。

问题是什么?WCF 服务中的操作合约数量是否有限制?

0 投票
1 回答
738 浏览

wcf - WCF 操作契约和列表大小

我的服务合同中有一个操作合同,它接受数据合同对象列表作为输入(void Foo(IList data))。如何限制集合中数据合同项的数量,以便 f.ex. 不超过500不能寄吗?

吨。尔基。

0 投票
1 回答
1201 浏览

c# - WCF wrapper for 3rd party web service - fire and forget [OperationContract(IsOneWay = true)]

I have created a WCF service which is a wrapper for a third party web service adding some additional functionality. The issue I have is that within my methods I want to call methods in the 3rd party web service but I don't want to wait for a response (the web service is very slow) on these methods. I have tried using [OperationContract(IsOneWay = true)] on my method but get the following error:

System.InvalidOperationException: The OperationContractAttribute declared on method 'MyMethod' in type 'MyService.MyService'is invalid. OperationContractAttributes are only valid on methods that are declared in a type that has ServiceContractAttribute. Either add ServiceContractAttribute to type 'MyService.MyService' or remove OperationContractAttribute from method 'MyMethod'.

Using [OperationContract(IsOneWay = true)] on methods which don't call the 3rd party web service works fine. Is there a way to do this?

This is the approach I am taking:

0 投票
2 回答
154 浏览

c# - WCF 类型转换

我被这个错误困住了..谁能指出我正确的方向在我的WCF服务中..我有一个定义如下的操作合同...

我正在从控制台应用程序调用上述方法,如下所示..

但是线条client.GetProductList(2);在 VS2012 中用红色下划线。如果我将鼠标移到它上面..我得到错误显示为..

在此处输入图像描述

0 投票
0 回答
43 浏览

wcf - WCF 服务数据合同已替换为 OperationContract 名称

将我的 wcf 添加到网站数据合同后,被操作合同取代。如何像代码 2 一样返回

代码1

代码2

0 投票
1 回答
103 浏览

wcf - 删除 TransactionScopeRequired = true

我有一个操作合同,在 Windows 服务上,它有一个属性

我想摆脱这个属性。原因 :

将服务容器化。和容器化的应用程序不支持 MSDTC ,这就是属性的目的!

这样做有什么影响?我可以确认操作合同中的代码插入到单个数据库中。没有触发事件,但是我不确定是否存在使用服务的事务。

我能得到一些建议吗?