我正在开发一个WCF服务(NetTcpBinding),它没有安全性就可以正常工作.我们从DigiCert购买了证书并将其安装在服务器上并使用DigicertUtil.exe进行配置.也安装在测试客户端机器上.
打开安全性我可以从我的开发PC连接到它没有问题.
服务器配置:
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate;
binding.Security.Transport.ProtectionLevel = ProtectionLevel.EncryptAndSign;
ServerHost.Credentials.ServiceCertificate.SetCertificate(
StoreLocation.LocalMachine,
StoreName.My,
X509FindType.FindBySubjectName,
Properties.Settings.Default.CertificateName);
Run Code Online (Sandbox Code Playgroud)
客户端配置:
<binding name="EndPointTCP" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="1610612736"
maxReceivedMessageSize="1610612736">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="false" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign"/>
</security>
</binding>
<behaviors>
<endpointBehaviors>
<behavior name="behavior_ServerService">
<clientCredentials>
<clientCertificate findValue="*.domain.com"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindBySubjectName" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="net.tcp://clients.domain.com:10001/Server/ServerService"
binding="netTcpBinding" bindingConfiguration="EndPointTCP" contract="ServerServiceReference.IServerWS"
name="EndPointTCP" behaviorConfiguration="behavior_ServerService">
<identity>
<dns value="*.domain.com" />
</identity>
</endpoint>
</client>
Run Code Online (Sandbox Code Playgroud)
(我修改了域名和服务名称以保护客户的隐私.)
从任何其他计算机尝试它我在客户端上收到以下错误:
套接字连接已中止.这可能是由于处理消息的错误或远程主机超出接收超时或基础网络资源问题引起的.本地套接字超时为'00:00:59.9840000'. …
我有一个带有 Angular 5.1.0 ClientApp (VS 2017 v15.4.5) 的 ASP.NET Core 2.0 项目。尝试使用 ngx-cookie-service。
我按照说明导入 ngx-cookie-service,但是每当我尝试将其 DI 到组件或服务构造函数中时,我都会得到这个
错误:
NodeInvocationException: StaticInjectorError[CookieService]:
StaticInjectorError[CookieService]:
NullInjectorError: No provider for CookieService!
Error: StaticInjectorError[CookieService]:
StaticInjectorError[CookieService]:
NullInjectorError: No provider for CookieService!
Run Code Online (Sandbox Code Playgroud)
app.module.browser.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppModuleShared } from './app.module';
import { AppComponent } from './components/app/app.component';
import { HttpModule } from '@angular/http';
import { CookieService } from 'ngx-cookie-service';
@NgModule({ …Run Code Online (Sandbox Code Playgroud) typescript angular-cookies asp.net-core-2.0 angular5 ngx-cookie-service