问题标签 [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 投票
3 回答
12270 浏览

wcf - WCF 中的大请求问题

我已经看到这个问题发布了一百万次,但没有一个解决方案对我有用......所以我开始了:

调用 WCF 服务时出现以下错误:

格式化程序在尝试反序列化消息时抛出异常:尝试反序列化参数 http://BlanketImportService.ServiceContracts/2011/06:request时出错。InnerException 消息是“反序列化 BlanketImport.BlanketImportRequest 类型的对象时出错。读取 XML 数据时已超出最大数组长度配额 (16384)。可以通过更改创建 XML 阅读器时使用的 XmlDictionaryReaderQuotas 对象的 MaxArrayLength 属性来增加此配额。第 1 行,位置 44440.'。有关更多详细信息,请参阅 InnerException。

readerQuotas在两个客户端服务器上都修改了,并应用了 bindingConfiguration 标记。

这是服务器配置:

和客户端配置:

0 投票
2 回答
9442 浏览

wcf - WCF - Streaming file upload over http

I am trying to build a WCF service that will allow my WPF desktop clients to upload files to a server.

I adapted a code sample from The Code Project (WCF Streaming: Upload/Download Files Over HTTP) and I've looked at several SO posts as well, but can't seem to get this working.

When I execute the code, it fails with a null reference exception at the point that the server tries to read the stream that has been passed through the interface.

At this point, I am rather lost and don't know how to fix this up. Any suggestions are appreciated.

Code samples follow:

CustomerDocumentModel is the data element that I pass through the WCF interface with the stream to read the client side file:

IBillingService is the interface definition for my WCF service:

The class BillingService implements the WCF service:

A few relevant bits from the web.config on my WCF web server:

The client is a WPF/MVVM app that creates a CustomerDocumentModel model, uses an OpenFileDialog to Open() the file stream and then passes the model to the UploadCustomerDocument method on WCF Service.

If I am missing any relevant details, please ask.

0 投票
1 回答
432 浏览

wcf - SharePoint:从 Silverlight 将文件添加到 SharePoint 库时出现 401 身份验证错误

我正在尝试从 silverlight 应用程序将 XML 文件添加到 SharePoint 2010 站点中的库。我按照https://sharepoint.stackexchange.com/questions/1837/how-can-i-upload-a-file-to-a-sharepoint-document-library-using-silverlight-and-cl中的步骤进行操作和http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/f135aaa2-3345-483f-ade4-e4fd597d50d4以及如何使用 Silverlight 和客户端 Web 服务将文件上传到 Sharepoint 文档库?.

但我收到一个 Auth 错误。

在对 silverlight 视图 (MVC) 进行一些更改时,数据库中的数据会更新。我在 silverlight Web 应用程序上触发了一个服务 (basicHTTP),以从数据库中获取数据并编写一个 XML 文件。写入文件后,我尝试使用 SharePoint 的 Copy Web 服务将文件上传到 SharePoint 库。

有什么线索吗?

编辑:

我尝试将用于上传文件的代码放在 silverlight 服务器的不同服务中。但是,我不能使用 WSHttp 绑定,因为 Silverlight 不支持它。我正在使用 basicHttp 绑定。如何发送 Windows 用户凭据?

0 投票
1 回答
535 浏览

wcf - WCF 服务和 IIS 是如何集成的,传入请求的架构和流程是什么

我最近一直在技术上测试 WCF 服务,并且已经到了这样的地步,我缺乏理解使我无法继续前进并找到解决我们看到的超时问题的方法。

我们正在对 Windows Server 2008 上的 IIS7 上托管的 WCF 服务进行负载测试。设置为触发消息的系统实际上会在 biztalk 应用程序上触发它们。Biztalk 然后处理消息并将它们发送到 WCF 服务的端点。WCF 服务也在其应用程序池中使用 .net 2.0(我想这意味着它实际上可能是 3.0 或 3.5,因为它们不是完整版本?

我们在一秒钟内发出 40 条消息,其中 90% 的消息由于客户端的发送超时(biztalk)而超时。起初我们认为这很奇怪,因为我们希望服务器的基本 http 绑定接收超时首先触发,但结果是设置为 10 分钟,客户端发送超时设置为 1 分钟和 30 秒。

我的理解:

WCF 服务具有配置文件,其中包含行为和 http 绑定。我们向其发送 XML 消息的服务器端点使用 BasicHtppBindings:Timeouts:Open/Close 为 1 分钟,发送和接收为 10 分钟。目前我们所知道的服务器超时时间是:sendtimeout: 1 分钟。

我了解 WCF 的架构通过创建通道工厂或服务主机的实例来工作,并创建一个通道堆栈,其中包含配置中的行为和绑定设置作为通道。有一个 TransportAdaptor,用于在 xml 消息通过通道堆栈处理后移动它。

我从 IIS 了解到 http.sys 处理传入的请求。它将请求传递给工作进程,当它很忙时,它将请求放入内核模式队列?我了解可以设置一些 machine.config 设置来增加此队列/限制此队列?

我也知道如何将应用程序池变成网络花园,并且我已经阅读过您可以增加每个核心的线程数,默认为 12;这是通过注册表设置或稍后在 .net 中更改 Web 配置来完成的。

我刚刚阅读了 InstanceContextMode 以及它如何影响服务器的服务......但我不确定在这种情况下设置为什么。

我们记录了一些性能计数器,.net 计数器,我注意到当前请求数减去(排队+断开)= 12。这表明我们使用的是 1 个核心?并且该内核上的线程数设置为 12。

任何人都可以帮助我获得更清晰的画面,并帮助我将一些额外的知识拼凑成更完整的东西吗?

0 投票
1 回答
589 浏览

silverlight - 从 SQL 数据库加载多行时出现 Silverlight 错误

我有一个使用 Entity Framework 4 构建的 Silverlight 应用程序,一堆 Silverlight 模块和一个包含我的 DomainService、Model 和 Web.Config 的 Web 项目。

我从本地 SQL Server 提取数据工作正常。我的一个 SL 模块从特定表中提取数据,当我在此表中有超过 4000 行时,应用程序崩溃并给我以下错误消息。当它有大约 1000 个鱼卵时,它工作得很好。所以,我想也许 DomainService 不能处理所有的行,或者我在 webconfig 中的绑定设置在某种程度上是错误的。我该怎么办?

错误信息:

{System.ServiceModel.DomainServices.Client.DomainOperationException:查询“LoadSiteCageData”的加载操作失败。远程服务器返回错误:NotFound。---> System.ServiceModel.CommunicationException:远程服务器返回错误:NotFound。---> System.Net.WebException:远程服务器返回错误:NotFound。---> System.Net.WebException:远程服务器返回错误:NotFound。在 System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 在 System.Net.Browser.BrowserHttpWebRequest.<>c_ DisplayClass5.b _4(Object sendState) 在 System.Net.Browser.AsyncHelper.<>c_ DisplayClass4.b_0(Object sendState) --- 内部异常堆栈跟踪结束 --- System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) 在 System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 在 System .ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) --- 内部异常堆栈跟踪结束 --- 在 System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult) 在 System.ServiceModel System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) 处的 .DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult) --- 内部异常堆栈跟踪结束 --- System.ServiceModel.DomainServices.Client.OperationBase .System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) 在 System.ServiceModel.DomainServices.Client.DomainContext 的 System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error) 完成(异常错误)。 C_DisplayClass1b.b _17(对象)

网络配置

0 投票
1 回答
607 浏览

wcf - 仅托管 WCF HttpBinding 的 IIS

我对 IIS 可以为 WCF 支持哪些绑定感到困惑。

我读过一些学习资料,它只能支持 basicHttpBinding,但我看过 Silverlight 演示,其中支持 NetTCPBinding?

对此问题的任何澄清表示赞赏。

谢谢

0 投票
1 回答
4621 浏览

c# - 具有客户端证书和基本身份验证的 WCF 客户端

我需要访问我们其中一位合作伙伴的网络服务。他们的服务受到客户端证书和基本身份验证的保护。我正在使用带有 BasicHttpBinding 的 WCF。

我可以使用传输级安全性连接证书。我知道证书正在工作,因为我不再收到 403 错误,但我收到 401,因为我无法将凭据与传输一起传递。据我所知,我只能有一种传输安全方案。

我怎样才能做到这一点?

谢谢

0 投票
4 回答
67660 浏览

wcf - Wcf 基本身份验证

使用简单的测试 Wcf 服务使用基本身份验证时遇到一些问题。我遇到了一个例外:

无法激活请求的服务“http://qld-tgower/test/Service.svc”。有关详细信息,请参阅 > 服务器的诊断跟踪日志。

在跟踪日志中它显示:

在主机('Basic')上配置的身份验证方案不允许在绑定'BasicHttpBinding'('Anonymous')上配置的身份验证方案。请确保将 SecurityMode 设置为 Transport 或 TransportCredentialOnly。此外,这可以通过 IIS 管理工具更改此应用程序的身份验证方案来解决,通过 ServiceHost.Authentication.AuthenticationSchemes 属性,在应用程序配置文件中的 <serviceAuthenticationManager> 元素,通过更新绑定上的 ClientCredentialType 属性,或通过调整 HttpTransportBindingElement 上的 AuthenticationScheme 属性。

但是当我使用不正确的用户名和密码时,我不明白它说它正在使用基本身份验证?

HTTP 请求未经客户端身份验证方案“基本”授权。从服务器收到的身份验证标头是“Basic realm="qld-tgower"”。

这是我的 web.config 详细信息

这是我的 App.config

我的测试应用

还有我的服务

我在这里缺少什么吗?

0 投票
2 回答
143 浏览

asp.net - silverlight 客户端无法与 wcf 通信

我有最奇怪的问题。我有一个使用 wcf 服务来获取其数据的 silverlight 客户端。这是客户端中的代码:

这些确切的设置在简单的控制台应用程序中工作得很好,但在 silverlight 客户端中无法工作......

有任何想法吗?

0 投票
2 回答
4601 浏览

asp.net - MessageXmlProtocolError 参数:调试资源字符串不可用。通常,关键和论据提供了足够的

我有一个网站,其中包含一个小的 Silverlight 插件,它调用一个非常简单的 WCF 服务来保存 Session 中的值。

它在我的 PC 上运行良好,并且仅在服务器(托管服务提供商)上的计算机上运行良好。我注意到对于安装了 Silverlight 开发人员版的所有机器,我的 Silverlight 应用程序工作正常,但是对于安装了 Silverlight 通用版的所有机器,我的应用程序在调用 WCF 服务时失败,并显示以下消息: 附加信息:[MessageXmlProtocolError] 参数:调试资源字符串不可用。通常,关键和论点提供了足够的信息来诊断...

我有 crossdomain.xml 和 clientaccesspolicy.xml 文件,它们应该是正确的,我使用的是没有安全性的 basicHttpBinding。此外,开发人员版本没有问题。任何人都可以帮忙吗?(Silverlight 版本 = 4)