.Net Core 不支持 WSHttpBinding
.Net Core does not support WSHttpBinding
将 WSHttpBinding 移动到 BasicHttpBinding....
问题陈述:WSHttpBinding 在 .Net 核心中不受支持。
当我的应用程序在 .Net 4.6 中时,我使用 WSHttpBinding 通过以下代码创建与 WCF 的连接。
var binding = new WSHttpBinding(SecurityMode.TransportWithMessageCredential);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;
binding.Security.Message.EstablishSecurityContext = false;
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
var cert = store.Certificates.Find(X509FindType.FindByThumbprint, "Thumprint", true)[0];
result = new MyClient(binding, address);
client = result as ClientBase<TInterface>;
client.ClientCredentials.ClientCertificate.Certificate = cert;
现在我正在将我的应用程序迁移到 .Net 核心,我发现不支持 WSHttpBinding。
我打算使用 BasicHttpBinding 并进行以下更改:
var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate;
使用 BasicHttpBinding 以下代码没有规定:
binding.Security.Message.EstablishSecurityContext = false;//This code is w.r.t. WSHttpBinding.
所以,我的问题是:这个改变是否可以接受,或者我应该采取其他方式吗?
请协助!
我做了同样的事情(从 FULL .NET FRAMEWORK 移动到 .NET CORE PROJECT)并且我发现 there is NO SUPPORT for WCF
...
我所做的是:
1 - Create a .NET STANDARD LIB PROJ
..参考您的 SOAP 端点(它支持 WCF)
2 - Reference your LIB to a .NET CORE PROJECT
希望对你有帮助!!
喜欢:
然后像这样引用它:
.net core 3.1 支持 Wshttpbinding。
-
You should use the Nuget --System.private.serviceModel to get the wshttp binding methods in .NET core 3.1
-
Below are the Nuget Packages that will be required.
in .NET Core & .NET 5
BasicHttpBinding and WSHttpBinding
通过安装 Nuget 包 System.ServiceModel.Http
版本 4.8.1
解决了我的问题
https://www.nuget.org/packages/System.ServiceModel.Http
运行 Visual Studio
中的程序包控制台管理器中的此命令
Install-Package System.ServiceModel.Http
在 .Net 5 中,Wshttpbinding 不再支持 SecurityMode Message。请改用 Transport。但是,它不如 Message 安全。
var binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Transport;
https://docs.microsoft.com/en-us/dotnet/framework/wcf/how-to-set-the-security-mode
将 WSHttpBinding 移动到 BasicHttpBinding....
问题陈述:WSHttpBinding 在 .Net 核心中不受支持。
当我的应用程序在 .Net 4.6 中时,我使用 WSHttpBinding 通过以下代码创建与 WCF 的连接。
var binding = new WSHttpBinding(SecurityMode.TransportWithMessageCredential);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;
binding.Security.Message.EstablishSecurityContext = false;
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
var cert = store.Certificates.Find(X509FindType.FindByThumbprint, "Thumprint", true)[0];
result = new MyClient(binding, address);
client = result as ClientBase<TInterface>;
client.ClientCredentials.ClientCertificate.Certificate = cert;
现在我正在将我的应用程序迁移到 .Net 核心,我发现不支持 WSHttpBinding。 我打算使用 BasicHttpBinding 并进行以下更改:
var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate;
使用 BasicHttpBinding 以下代码没有规定:
binding.Security.Message.EstablishSecurityContext = false;//This code is w.r.t. WSHttpBinding.
所以,我的问题是:这个改变是否可以接受,或者我应该采取其他方式吗? 请协助!
我做了同样的事情(从 FULL .NET FRAMEWORK 移动到 .NET CORE PROJECT)并且我发现 there is NO SUPPORT for WCF
...
我所做的是:
1 - Create a .NET STANDARD LIB PROJ
..参考您的 SOAP 端点(它支持 WCF)
2 - Reference your LIB to a .NET CORE PROJECT
希望对你有帮助!!
喜欢:
然后像这样引用它:
.net core 3.1 支持 Wshttpbinding。
-
You should use the Nuget --System.private.serviceModel to get the wshttp binding methods in .NET core 3.1
-
Below are the Nuget Packages that will be required.
in .NET Core & .NET 5
BasicHttpBinding and WSHttpBinding
通过安装 Nuget 包 System.ServiceModel.Http
版本 4.8.1
https://www.nuget.org/packages/System.ServiceModel.Http
运行 Visual Studio
中的程序包控制台管理器中的此命令Install-Package System.ServiceModel.Http
在 .Net 5 中,Wshttpbinding 不再支持 SecurityMode Message。请改用 Transport。但是,它不如 Message 安全。
var binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Transport;
https://docs.microsoft.com/en-us/dotnet/framework/wcf/how-to-set-the-security-mode