wcf 相关问题

Windows Communication Foundation是.NET Framework的一部分,它为快速构建面向服务的应用程序提供了统一的编程模型。

net Framework 4.8 + tls.13 = 请求被中止:无法创建 SSL/TLS 安全通道

美好的一天。我正在使用 tls1.3 更新 net Framework 4.8 wcf 服务(第三方将在 2024 年初停止支持 tls12)并面临“请求已中止:无法创建 SSL/TLS 安全

回答 1 投票 0

如何在不使用 ping 的情况下检查 Web 服务是否已启动并正在运行?

我如何检查网络服务中的方法是否正常工作?我无法使用 ping。我仍然想检查客户端从 Web 服务调用的任何类型的方法。我知道这是不同的...

回答 9 投票 0

WCF 服务会公开属性吗?

在实现 WCF 服务所需的接口中,我使用 [ServiceContract()] 属性声明主类,并使用 [OperationContract()] 声明任何公开的方法。 我怎样才能暴露公众

回答 6 投票 0

BizTalk 拆分存储过程结果

当我从 BizTalk 调用存储过程时,结果会分布在多个节点上。存储过程返回因拆分而被破坏的 XML。 多个来源说明了正确的配置...

回答 2 投票 0

实体表存在,但我无法通过模型访问它

我在 Visual Studio 2019 中使用 C#、.NET 4.6 和 EF 6.13。我添加到数据库的新表开始出现问题,然后刷新我的模型。然后我刷新了模型。 当我去访问时...

回答 1 投票 0

在相同的两个对象类型之间创建两个 Automapper 映射

我在 WCF 服务中使用 AutoMapper 返回 User 对象。用户具有诸如 AccountTeams 之类的属性,该属性本身也具有子对象。所有类都有 AutoMapper 地图。 取决于...

回答 4 投票 0

出现超时错误 - 增加绑定时的发送超时值

WCF 服务返回超时错误,如下所示。 XX:XX: XX 增加绑定时的发送超时值后,请求通道在等待回复时超时。分配给此操作的时间...

回答 2 投票 0

签署 Soap 消息,但无法使用 u-id 属性引用正文

我正在使用生成的连接服务(Soap)来生成签名。 服务器只期望消息在正文上签名。所以我需要提供 Body 的 Id 参考。 那里...

回答 1 投票 0

使用 WCF REST 服务进行基本身份验证的内置方法?

我在 WCF 服务中使用基本身份验证。 并且还使用 ASP 会员资格提供程序进行身份验证。 网络配置: 对于 REST 服务: 我在 WCF 服务中使用基本身份验证。 并且还使用 ASP 会员资格提供商进行身份验证。 网络配置: 对于 REST 服务: <webHttpBinding> <binding name="webHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="200065536" maxBufferPoolSize="200065536" maxReceivedMessageSize="200065536" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="202048000" maxStringContentLength="202048000" maxArrayLength="202048000" maxBytesPerRead="202048000" maxNameTableCharCount="202048000"/> <security mode="Transport"> </security> </binding> </webHttpBinding> 认证类型及模式: <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="CustomMemberShipProvider" /> </serviceCredentials> 在调用任何方法之前,我的 BasicAuthentication 自定义类。 代码如下所示: namespace BasicAuth.Service { public class BasicAuthenticationInvoker : Attribute, IOperationBehavior, IOperationInvoker { #region Private Fields private IOperationInvoker _invoker; #endregion Private Fields #region IOperationBehavior Members public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation) { _invoker = dispatchOperation.Invoker; dispatchOperation.Invoker = this; } public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation) { } public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters) { } public void Validate(OperationDescription operationDescription) { } #endregion IOperationBehavior Members #region IOperationInvoker Members public object Invoke(object instance, object[] inputs, out object[] outputs) { System.Diagnostics.Debugger.Break(); if (Authenticate()) return _invoker.Invoke(instance, inputs, out outputs); else { outputs = null; return null; } } public object[] AllocateInputs() { return _invoker.AllocateInputs(); } public IAsyncResult InvokeBegin(object instance, object[] inputs, AsyncCallback callback, object state) { throw new NotSupportedException(); } public object InvokeEnd(object instance, out object[] outputs, IAsyncResult result) { throw new NotSupportedException(); } public bool IsSynchronous { get { return true; } } #endregion IOperationInvoker Members private bool Authenticate() { string[] credentials = GetCredentials(WebOperationContext.Current.IncomingRequest.Headers); if (credentials != null && credentials.Length == 2) { var username = credentials[0]; var password = credentials[1]; if (Membership.ValidateUser(username, password)) //if valid user { //get the roles of the user string[] roles = Roles.GetRolesForUser(username); Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity(username), roles); return true; } } WebOperationContext.Current.OutgoingResponse.Headers["WWW-Authenticate"] = string.Format("Basic realm=\"{0}\"", string.Empty); WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Unauthorized; return false; } private string[] GetCredentials(WebHeaderCollection headers) { string credentials = WebOperationContext.Current.IncomingRequest.Headers["Authorization"]; if (credentials != null) credentials = credentials.Trim(); if (!string.IsNullOrEmpty(credentials)) { try { string[] credentialParts = credentials.Split(new[] { ' ' }); if (credentialParts.Length == 2 && credentialParts[0].Equals("basic", StringComparison.OrdinalIgnoreCase)) { credentials = Encoding.ASCII.GetString(Convert.FromBase64String(credentialParts[1])); credentialParts = credentials.Split(new[] { ':' }); if (credentialParts.Length == 2) return credentialParts; } } catch (Exception ex) { } } return null; } } } 我的 Iservice 如下所示: 我的自定义类用作 Iservice 合约中的属性 public interface IService1 { [OperationContract] [BasicAuthenticationInvoker] //my custom class for authentication [WebGet(UriTemplate = "GetString?userID={userID}", ResponseFormat = WebMessageFormat.Json)] string GetString(string userID); } 使用 AJAX 调用调用 WCF REST 服务时,我将 Authentication 标头添加到请求中,并使用上述自定义类对用户进行身份验证。 AJAX 调用: 下面是用于调用服务的 Ajax 调用,并在访问服务之前使用 beforeSend 对用户进行身份验证。 <script> $(function () { alert("onload"); $.ajax ({ type: "GET", data:jsondata, url: https://localhost:446/BasicAuthService.svc/rest/GetString', cache: false, async: true, crossDomain:true, dataType: "json", contentType: "application/json; charset=utf-8", beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Basic plc2gxMjMk'); }, error: function(jqXHR, exception) { alert(jqXHR.status+" "+exception); } }); }); </script> 我的问题是: 我希望您能全面了解我的代码是如何工作的。 所以我需要的是,如何验证对服务的每个请求,而不是使用自定义类进行BasicAuthentication? WCF 中是否有任何内置功能用于验证传入请求? 提前致谢。 您的安全模式应指定基本身份验证: <security mode="Transport"> <transport clientCredentialType="Basic" /> </security>

回答 1 投票 0

WPF 和 WCF 数据服务在查询级别进行身份验证?

所以,我发誓我对如何保护 WCF 数据服务完全感到困惑。是否有一种简化的检查方法来确保将数据发送到 WCF 服务的客户端是

回答 2 投票 0

无法将 WCF Web 服务添加到 .NET 6.0 VB.NET Winforms 应用程序

我似乎无法将 WCF Web 服务添加到 VS2022 中的 Winforms .NET 6 应用程序。我所看到的只是“连接服务”和添加“服务依赖项”的能力。 我已经包括了

回答 1 投票 0

对异步 WCF 服务的调用按顺序执行

我已经构建了一个基本的 WCF 控制台服务器应用程序。我的目标是以并行方式处理对其的多个调用,但当前版本按顺序处理它们。 请耐心等待,因为我...

回答 1 投票 0

DocuSign Connect Webhook 以调用 WCF Rest 服务端点

我在 DocuSign Connect 访问我们的 WCF 端点时遇到问题。 我们有以下 WCF 端点,它接受 Stream 参数。 【运营合同】 [WebInvoke(方法 = "POST",

回答 1 投票 0

System.ServiceModel 核心 wcf 客户端绑定

我正在使用 .NET Core 6 并拥有 System.ServiceModel 的 6.0 Nuget 包,这是这个开源代码:https://github.com/dotnet/wcf 我正在尝试从 .NET 框架复制客户端绑定...

回答 1 投票 0

是否可以强制WCF测试客户端接受自签名证书?

我有一个使用自签名证书在 IIS 7 中运行的 WCF Web 服务(这是一个概念证明,以确保这是我想要走的路线)。需要使用 SSL。 是否可以使用...

回答 7 投票 0

不支持Svcutil配置文件.net core

我正在使用 svcutil 将 wcf 服务引入我的项目。 但我在尝试初始化soapClient时收到错误: ServiceSoapClient 客户端 = new ServiceSoapClient(); 这是错误: 配置

回答 3 投票 0

C# Web 服务返回时丢失数据

我正在编写一个调用 webmethod 的客户端程序,但是当我获取返回数据时,某些字段和对象上缺少值。 webmethod 依次调用 WCF 方法...

回答 3 投票 0

为 Azure 服务总线主题创建侦听器

我有一个用 .NetFramework 4.6 编写的 WCF 服务,该服务处理对客户执行的所有 CRUD 操作。我用 .Net core 3.0 编写了微服务。 WCF 服务正在发送

回答 1 投票 0

system.servicemodel 核心 WCF 绑定支持

我正在使用 .NetCore6 并拥有 System.ServiceModel 的 6.0 Nuget 包,这是这个开源代码:https://github.com/dotnet/wcf 我正在尝试从 .net 框架复制客户端绑定...

回答 1 投票 0

WCF Web 服务错误:“服务端点绑定不使用 HTTP 协议”?

我有一个简单的 WCF 服务,当我在我的开发机器上进行测试时,该服务运行良好。 现在我已将 Web 服务移至 Web 服务器,并在 http://

回答 9 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.