问题标签 [wshttpbinding]

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 投票
1 回答
968 浏览

wcf - WCF 在连接到 SQL Azure 时禁用 UseNagleAlgorithm

在 Azure 上托管大量访问 SQL Azure 数据库的 WCF REST 服务。我看到 ServicePointManager.UseNagleAlgorithm 设置为 true。我知道将其设置为 false 会加快对表存储的调用(插入记录 < 1460 字节) - 以下链接讨论了它。

我的问题 - 禁用 Nagle 算法也会加快我对 SQL Azure 的调用速度吗?

0 投票
2 回答
17025 浏览

c# - 带有 wsHttpBinding 的 WCF 服务 - 操作 HTTP 请求标头

我一直在关注教程,以便在我的 WCF 服务中使用传输安全性获得用户名身份验证。然而,本教程提到使用basicHttpBinding哪个是不可接受的 - 我需要wsHttpBinding.

这个想法是BasicAuthenticationModule在 WCF 服务上有一个自定义,它将从 HTTP 请求中读取“授权”标头并根据“授权”标头内容执行身份验证过程。问题是缺少“授权”标头!

我已经IClientMessageInspector通过自定义行为实现了以操纵传出消息并添加自定义 SOAP 标头。我在BeforeSendRequest函数中添加了以下代码:

这应该有效,并且根据许多网络资源,它适用于basicHttpBinding但不适用于wsHttpBinding. 当我说“有效”时,我的意思是 WCF 服务已成功接收到标头。

这是检查 WCF 服务端收到的 HTTP 消息的简化函数:

线程 2011 年 9 月的底部帖子说,这是不可能的wsHttpBinding。我不想接受这种回应。

作为旁注,如果我使用 IIS 中内置的基本身份验证模块而不是自定义模块,我会得到

参数“用户名”不得包含逗号。** 尝试时出现错误消息Roles.IsInRole("RoleName")或 `[PrincipalPermission(SecurityAction.Demand, Role = "RoleName")]

可能是因为我的PrimaryIdentity.Name属性包含证书主题名称,因为我正在使用TransportWithMessageCredential基于证书的消息安全性的安全性。

我愿意接受建议以及解决问题的替代方法。谢谢。

更新

看起来,HTTP 标头稍后会在整个 WCF 服务代码中正确读取。 (HttpRequestMessageProperty)OperationContext.Current.IncomingMessageProperties["httpRequest"]包含我的自定义标题。但是,这已经是消息级别的了。如何将标头传递给传输身份验证例程?

更新 2
经过一番研究,我得出一个结论,当 Web 浏览器收到 HTTP 状态代码 401 时,它会向我显示登录对话框,我可以在其中指定我的凭据。然而,WCF 客户端只是抛出一个异常并且不想发送凭据。https://myserver/myservice/service.svc在 Internet Explorer 中访问时,我能够验证此行为尝试使用链接中的信息进行修复,但无济于事。这是 WCF 中的错误还是我遗漏了什么?

编辑

以下是我system.servicemodel(来自web.config)的相关部分 - 我很确定我的配置正确。

服务返回的异常是:

HTTP 请求未经客户端身份验证方案“匿名”授权。从服务器收到的身份验证标头是“Basic Realm,Negotiate,NTLM”。(远程服务器返回错误:(401) Unauthorized。)

0 投票
1 回答
2133 浏览

wcf - 如果排除 bindingNamespace 属性,webHttpBinding 端点会在 WSDL 中添加 temuri.org 命名空间

我有一个需要通过 SOAP 端点 (wsHttpBinding) 和 REST 端点 (webHttpBinding) 公开的 WCF 服务。我在相关属性中包含了名称和命名空间以帮助进行版本控制(tempuri.org 应该从 WSDL 中完全删除)。出于某种原因,如果我不在 webHttpBinding 端点上添加 bindingNamepace 属性,它会在 WSDL 中添加 tempuri.org 命名空间。示例 WSDL 输出如下。

没有 bindingNamespace 的 WSDL -

带有 bindingNamespace 的 WSDL -

这是我的端点的 web.Config。我正在使用 WCFExtras 来展平我的 WSDL(因此 wsHttpBinding 端点上的行为配置),但没有它的行为是相同的。

我已经在我的解决方案中加载了 WCFExtras 并查看了 WsdlExporter 以查看是否可以找到 tempuri.org 的提及但没有成功。我还使用 XSharper.Core 转储对象图以查看是否可以找到它。它不在那里。

有谁之前经历过这个吗?作为一种解决方法,我将在 webHttpBinding 端点上包含 bindingNamespace 以保持 WSDL 干净,但我想知道为什么会发生这种情况。

谢谢!

0 投票
1 回答
5477 浏览

wcf - 当negotiationServiceCredential 设置为false WCF 客户端获取:收到来自另一方的不安全或不正确安全的故障

我构建了一个使用 wsHttpBinding 的 WCF 服务和一个调用它的客户端。
但我仍然收到以下错误消息:

内部例外是:

这是服务的配置文件:

这是客户端配置文件:

有问题的配置是:negotiateServiceCredential="false"。
如果我在服务和客户端中都将其设置为 true,则客户端将完美运行。(除了此更改之外,使用上述配置文件)

谁能告诉我在这里想念什么?

提前致谢。

0 投票
1 回答
180 浏览

wcf - WCF 安全 - 新手问题 -

我一整天都在阅读有关 WCF 安全性的信息,但不能说我对它感到满意。

我已经开发了一些 WCF 服务并将它们部署到测试服务器,并且可以从客户端调用。双方 C#/VS 2010。服务托管在 IIS 6 下。目前没有选择更新的选项。

所以 - 我读过我只能在 IIS 6 中使用 HTTP - 我相信这限制了我使用 basicHttpBinding 或 wsHttpBinding 作为绑定。

我还读到使用 wsHttpBinding 通过网络发送的 XML 是加密的,而 basicHttpBinding 不是。

所以看起来我想使用 wsHttpBinding,因为我需要某种身份验证,并且我想用户名/密码将与传入的消息一起传递。

第一个问题是 - 如果我使用 wsHttpBinding 客户端是否必须使用 https 调用?然后我需要担心服务器上的证书等吗?

第二个问题是 - 我可以使用哪些安全选项?调用者必须是服务器上的 Windows 用户,还是我可以自己编一个用户名/密码,让服务的那部分和服务进行验证,与 Windows 用户无关?如果我必须与 Windows 用户一起使用,我想在服务器上设置一个用户帐户并让所有呼叫者都使用它是很常见的吗?

基本思想是我需要向选定的调用者开放此服务,但不希望任何人都能够发现该服务并调用它。我需要以某种方式控制谁调用该服务。用户名/密码是执行此操作的标准方式吗?例如,我可以定义一个所有调用者都必须通过的 GUID 吗?

0 投票
1 回答
861 浏览

php - php 和 WCF WebServices 之间互操作性的第三方解决方法

我必须使用带有 php 客户端和 AKAIK 的 WCF Web 服务(1.2),php 本身不符合 wsHttpBinding 方法(真的吗?)。我尝试过使用 WSDL 文件时出现错误:

没有它:

Nusoap 无法帮助我,因为它不支持 SOAP 1.2,除了 WSO2(太复杂而无法集成)之外,我还可以使用其他解决方案吗?

感谢您的建议

编辑这里的 WSDL 文件:

0 投票
1 回答
951 浏览

wcf - 使用哪个正确的 WCF 绑定?

我有以下标准来帮助我选择 WCF Http 绑定。我的服务需要:

  1. 部署在Intranet支持模拟/委托
  2. 可以与使用未知技术的客户互操作
  3. 支持客户端和服务器之间的事务流
  4. 尽可能不使用证书(放弃“传输”安全模式)

我们需要在basicHttpBindingwsHttpBinding之间做出决定。

以下是关于这三点的一些注意事项和问题:

  1. 我相信带有“Message”安全模式和“Windows”clientCredentialType 的 wsHttpBinding 将允许我执行委托。
  2. 第 1 点中选择的安全配置来实现委托似乎确实使互操作性难以支持,对吗?WS-* 标准 (wsHttpBinding) 绝对是可互操作的,但是结合“消息”安全性和“Windows”凭证,任何WS-* 兼容的客户端都可以调用我的服务吗?
  3. 我相信 wsHttpBinding 似乎是支持事务流的方式?
  4. 在我们的情况下,使用没有证书的“消息”安全似乎更简单?

提前致谢

0 投票
1 回答
266 浏览

wcf - Do I really need reliable sessions for my services? (description inside)

Our company leases a music service to it's clients. The product consists of an automated mp3 player and daily renewals/updates of the costumers music library (mp3 songs) downloaded to their machines. So far we use an ugly solution for the mp3 updates, by synchronizing server and client folders using GBridge. This is obviously a disadvantage, as we force our clients to download our whole music library (currently 25.000 songs) while most of them will never play songs from all of our music categories (pop, rock etc). Most important we can only offer one subscription packet (our whole music library) while our competitors offer packets by categories with lower prices. For those reasons we decided to turn to WCF.

The service uses PerCall instancing mode and implements two operations, invoked from a winform client application with the classic request-reply pattern.

The first operation retrieves from a database the categories a client is allowed to download from (request) and sends back to the client a list of these categories (reply).

The second operation is used for downloading. The client first downloads an xml version of the server's database. A similar xml lies on the client side. The client app checks which songs, in each of the categories returned from the first operation, are missing in it's own xml compared to the server's xml file. If there are any files (elements on the xml) missing, it downloads them one file at a time. After each download, the client updates his xml and does the same comparison again until all files (elements) match in the 2 xml.

Long story short, considering that the instancing mode on the service is PerCall for throughput reasons and keeping memory consumption low and that both my operations use the request-reply pattern which means that the acknowledgement messages will be send back to the client with each response from the service, so if something goes wrong in the connection or if the client can't reach the service I can catch the CommunicationObjectFaultedException on the client, reconstruct the proxy and retry do you think theres a need for reliable sessions on my service implementation? What problems could arise if I don't have reliable sessions in the operations just described?

0 投票
1 回答
592 浏览

c# - 使 wsHttpBinding 替代 netTcpBinding 的场景是什么

我们在 asp.net webforms Intranet 应用程序中使用 netTcpBinding。

在客户端机器上,我们正在运行 activeX (winforms),它通过 wcf 检索其数据。

activeX 容器位于 asp.net 应用程序中。

使用 wsHttpBinding 而不是 netTcpBinding 我们有什么优势/好处?

0 投票
1 回答
4710 浏览

c# - WCF 从 Basic 到 wsHttpBinding

我现在已经让我的配置正常工作,实际文件结构和 Visual Studio 中的项目结构不匹配。愚蠢的错误:)

但是,现在我遇到了从 basicHttpBinding 过渡到 WsHttpBinding 的问题。这是网络配置。如您所见,我已将第一个端点更改为 wsHttpBinding 类型。

当我尝试在本地主机上运行它时,我收到以下错误消息:

我发现一些关于 IIS 解析多个基地址的文章,但这是本地的,所以我不知道为什么它不起作用。

我在这里缺少什么吗?只要我只使用basicHttpBindings,配置文件就可以正常工作。

任何帮助将不胜感激,tyvm!