问题标签 [basichttpbinding]

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 投票
0 回答
257 浏览

wcf - WCF + SmtpClient: only works in a Windows 2008 environment

Continuing the discussion started in another post: I used windows service to host a WCF mail sender. The service itself is quite simple: it uses a DataContract to get the basic System.Net.Mail.MailMessage class properties (supports attachment - please see the mentioned post, code by edosoft) and the System.Net.Mail.SmtpClient class to actually send the e-mail. The .NET framework used was 3.5SP1 (with VS2008).

Please note that I already had the code working inside an assembly; the exercise was just to expose the functionality by using a WCF service. I used basicHttpBinding for the endpoint binding, no additional configurations.

When I tested the service in my desktop environment (Windows XP) I noticed the following:

  • The e-mails were only sent if I restarted the windows service in the first 10-15 seconds after calling the WCF service, otherwise nothing would happen;

  • No exception/error messages whatsoever in the service trace/log files;

  • No exception/error messages when calling the SmtpClient.Send(MailMessage msg) method or anywhere else when running the service code.

I played with different bindings and configurations for a while, even tried to send the message from a different thread - no changes. I actually came accross with a forum question related to this problem: the same method called from within an ASMX webservice would only work is an IISRESET was performed. I was able to replicate this issue by creating an ASMX webservice using the same sending code used in the WCF. Hosting the WCF service under IIS was also of no help (same problem).

I decided then to deploy the service in a Windows 2008 environment (windows service hosted) - see, no changes in the original, simple code. Same configuration, same everything. It worked right away, no delays or any other problem I could identify. Does anyone have any idea about this issue? I'll try it in a Windows 2003 environment now, but I'd like to know if it's actually a known bug/limitation, or if it's somehow related to the ASMX bug related (as it appears to be). Does anyone have seen it before?

Thanks,

0 投票
2 回答
1426 浏览

wcf - WCF BasicHttpBinding Http 发布

是否可以发布到 IIS 中托管的 WCF 服务?我知道使用 REST 可以做到这一点,但我确实需要 WSDL 生成和 SOAP 标头。我需要将现有的 ASMX Web 服务转换为 WCF,但我还需要允许我的客户通过 http 帖子(通过 javascript 的 xml http 请求)继续使用该服务。REST 是我唯一的选择吗?

0 投票
2 回答
2302 浏览

java - 使用 java 通过 TransportWithMessageCredentials (UserName) 访问 WCF 服务

我开发了一个 WCF 服务,它使用 BasicHttpBinding 和 TransportWithMessageCredentials 以及自定义用户名和密码验证。我有一个需要与我的服务交互的客户端,但客户端使用 Java。我自己不是 Java 程序员,我帮不了他太多。所以我想我会将这个问题扩展到 SO 社区。你们能在这里阐明一下吗?

0 投票
1 回答
1320 浏览

c# - WCF 与 basicHttpBinding、加密、签名和 usernameToken over HTTP

我正在尝试配置 WCF 客户端以生成正确的请求。在该请求中,我需要带有 usernameToken 的安全标头。另外,我需要加密和签署请求。所有这些都是通过纯 HTTP 进行通信的。

到目前为止,我已经设法让客户端签名和加密消息。现在我需要以某种方式将 usernameToken 合并到这个安全标头中。

我怎样才能做到这一点?

我正在使用 basicHttpBinding,安全模式设置为“Message”,clientCredentialType =“Certificate”用于消息。

我偶然发现了 clearUsernameToken 绑定库,但我认为无法将所有这些(用户名令牌、签名和加密)合并到一个客户端中,并且所有这些都通过 HTTP。

这甚至可能吗?

0 投票
1 回答
133 浏览

wcf - 在 XmlDictionaryReaderQuotas 对象上设置更高的值是否有任何陷阱,特别是 MaxStringContentLength 和 MaxArrayLength?

特别注意,这是针对对象的ReaderQuotas属性BasicHttpBinding。具体来说,我可能有(非常)少数情况,我的当前值 163,840,000(来自先前开发的神奇未记录值,不确定来源)是不够的。然而,对于看似很少的边缘情况,我对提高这个值感到厌烦,尽管它们在生产(付费客户的)环境中可能很重要。

我想知道的是,除了明确允许大量数据被序列化并沿管道发送(这是针对 WCF 端点)之外,在使用更高的值时是否存在任何已知或隐藏的缺陷?如果存在陷阱,它们可能是什么,以及会受到什么影响。

0 投票
1 回答
3653 浏览

silverlight - 具有 basicHttpBinding 的 WCF 服务是否为每个请求创建一个新连接?

我有一个 Silverlight 客户端在 IIS Web 服务器上调用 WCF 服务。它对调用使用默认的 basicHttpBinding 设置。我的客户端代码具有使用“更新服务参考”菜单选项时生成的常用 Visual Studio 生成代理。

使用该代理对服务的每次调用是否都使用相同的连接?还是每次拨打电话时都会建立连接,然后在收到回复后将其关闭?由于客户端实际上是通过 HTTP 进行 SOAP 调用,我只是假设每个服务请求都创建了一个新连接,但我想检查是否是这种情况?

(我需要知道,因为如果它每次都创建一个新连接,那么每个请求都可能在不同的服务器上结束,因为有几台服务器正在负载平衡。它在代理期间使用单个连接,那么我可以假设他们所有最终都在同一台机器上,因此缓存状态信息以获得更好的性能。)

0 投票
1 回答
5098 浏览

wcf - WCF Basichttpbinding 400 错误

我正在使用 Fiddler 向我的网络服务发布一个肥皂请求。我在使用控制台应用程序客户端(使用服务引用代理)时捕获了来自服务的请求。通过服务参考客户端的请求工作正常。但是,当我在提琴手中使用相同的请求数据时,我收到 400 bad request 错误。我在提琴手中使用的请求数据如下。任何指导都会很棒!

在提琴手中使用以下内容标题

内容长度:786 内容类型:文本/xml SoapAction:http ://tempuri.org/Service1/Test

编辑:我发现了确切的错误,但我不确定它是什么意思。错误是寻址版本“AddressingNone (http://schemas.microsoft.com/ws/2005/05/addressing/none)”不支持添加 WS-Addressing 标头。有任何想法吗?

0 投票
1 回答
20813 浏览

c# - BasicHttpBinding 等效 CustomBinding 使用 WCF 客户端和 PHP WebService

我正在使用 WCF 使用 WebService PHP 运行 Visual Studio 2008 单元测试 C#,但收到以下错误:

System.ServiceModel.Security.MessageSecurityException:HTTP 请求未经客户端身份验证方案“匿名”授权。从服务器收到的身份验证标头是“NTLM,Basic realm="(null)"”。---> System.Net.WebException: 远程服务器返回错误: (401) Unauthorized..

我正在使用 Windows XP SP3 机器、单元测试 VS 2008 和 WCF 连接到 PHP WebService。

我无法控制 PHP WebService。我无法修改它(既不是配置安全性)。

这是我使用 web 服务 PHP 的客户端的配置文件:

真的,我使用 C# 代码:

更新:测试

我添加这一行:

我收到此错误:HTTP 请求未经客户端身份验证方案“匿名”授权。从服务器收到的身份验证标头是 'NTLM,Basic realm="(null)"'

我添加这一行:

我得到这个错误:

System.ServiceModel.CommunicationObjectFaultedException: El objeto de comunicación, System.ServiceModel.Channels.ServiceChannel, no se puede usar para la comunicación porque se encuentra en el estado 故障。

//服务器堆栈跟踪: // en System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)

我添加这一行:

我得到这个错误:

/Exception = System.ServiceModel.CommunicationException: Versión de mensaje no reconocida。

//服务器堆栈跟踪: // en System.ServiceModel.Channels.ReceivedMessage.ReadStartEnvelope(XmlDictionaryReader reader)

// en System.ServiceModel.Channels.StreamedMessage..ctor(XmlDictionaryReader reader, Int32 maxSizeOfHeaders, MessageVersion desiredVersion)

// en System.ServiceModel.Channels.Message.CreateMessage(XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders, MessageVersion 版本)

// en System.ServiceModel.Channels.Message.CreateMessage(XmlReader envelopeReader, Int32 maxSizeOfHeaders, MessageVersion 版本)

// en CustomTextEncoder.CustomTextMessageEncoder.ReadMessage(Stream stream, Int32 maxSizeOfHeaders, String contentType) en E:\TFS\pro\CustomTextEncoder\CustomTextMessageEncoder.cs:línea 66

// en System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, Int32 maxSizeOfHeaders)

// en CustomTextEncoder.CustomTextMessageEncoder.ReadMessage (ArraySegment`1 buffer, BufferManager bufferManager, String contentType) en E:\TFS\pro\CustomTextEncoder\CustomTextMessageEncoder.cs:linea 60

// en System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, BufferManager bufferManager, Int32 maxBufferSize, String contentType)

// zh System.ServiceModel.Channels.HttpInput.ReadChunkedBufferedMessage(Stream inputStream)

我认为,以下是正确的配置(如果是 basichttpbinding)

basichttpbinding中WCF的Web服务可能不够灵活。顾名思义,CustomBinding 允许用户设计自己的 Web 服务绑定。

我需要使用CustomBinding和 SecurityMode (like basichttpbinding): WCF BasicHttpBinding equivalent CustomBinding

我需要安全模式:TransportCredentialOnly、Basic、HTTP 传输和编码="ISO-8859-1"

http://www.codemeit.com/security/wcf-basichttpbinding-equivalent-custombinding.html

http://social.msdn.microsoft.com/Forums/en/wcf/thread/6cefadf1-9939-4f3b-a502-2d79a30c7d3a

http://offroadcoder.com/2008/03/23/CallingYourNusoapPHPWebServiceFromWCF.aspx

http://msdn.microsoft.com/en-us/library/ms731092(v=VS.90).aspx

我再次尝试使用此配置,但出现错误:

配置:

错误(InnerException 为空):

错误:无法识别的消息版本

类型:System.ServiceModel.CommunicationException Mensaje:Versión de mensaje no reconocida。StackTrace:服务器堆栈跟踪:

zh System.ServiceModel.Channels.ReceivedMessage.ReadStartEnvelope(XmlDictionaryReader 阅读器)

en System.ServiceModel.Channels.StreamedMessage..ctor(XmlDictionaryReader reader, Int32 maxSizeOfHeaders, MessageVersion desiredVersion)

en System.ServiceModel.Channels.Message.CreateMessage(XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders, MessageVersion 版本)

en System.ServiceModel.Channels.Message.CreateMessage(XmlReader envelopeReader, Int32 maxSizeOfHeaders, MessageVersion 版本)

en Reale.IntegracionEasyVista.CustomTextEncoder.CustomTextMessageEncoder.ReadMessage(Stream stream, Int32 maxSizeOfHeaders, String contentType) en E:\IntegracionEasyVista\CustomTextEncoder\CustomTextMessageEncoder.cs:línea 66

en System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, Int32 maxSizeOfHeaders) en Reale.IntegracionEasyVista.CustomTextEncoder.CustomTextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType) en E:\IntegracionEasyVista\CustomTextEncoder\CustomTextMessageEncoder.cs :linea 60

en System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, BufferManager bufferManager, Int32 maxBufferSize, String contentType)

zh System.ServiceModel.Channels.HttpInput.ReadChunkedBufferedMessage(Stream inputStream)

zh System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)

zh System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

en System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

en System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)

en System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

en System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] out)

en System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime 操作)

zh System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息)

更多信息:Service.php 的 WDSL 的一部分

0 投票
1 回答
1938 浏览

android - ksoap2 (Android) 和 GZIPped BasicHttpBinding

我想使用由 GZIP 压缩的带有 ksoap2 的 BasicHttp WCF Web 服务。

有没有办法在 Android 版本的 ksoap2 (http://code.google.com/p/ksoap2-android/) 中做到这一点,还是有其他方法?

0 投票
1 回答
11162 浏览

wcf - WCF Configuration - basicHttpbinding

I have problem with basic configuration of WCF. I am working on MobilePhone Application . First I created test desktop appliction which use basicHttpBinding and everything was fine. Next I used the same code (Only difference is in ServerReference - In phone I used Two Server Files generated using NetCFSvcUtil). In Phone Application I am getting Endpoint no Found Exception. Below I am putting my configuration. I would be grateful for help or suggestions.

Regards.

Exception on Phone side:

There was no endpoint listening at http://localhost:4444/Service/PhoneService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Phone Configuration:

** revelant fragment of Server Configuration**

*Configuration in browser *

PhoneService Service

You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe http://localhost:4444/Service/PhoneService?wsdl

This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example: