我想用C#代码创建服务行为,但我不知道如何创建。
下面是行为的配置:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ValidateUser">
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="ConsoleApplication1.CustomUserNameValidator"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>发布于 2017-05-31 20:25:07
试着做这样的事情:
var srvCredentials =新的ServiceCredentials();
ServiceCredentials类在"System.ServiceModel.Description“中。
我希望这能帮到你!
https://stackoverflow.com/questions/44281776
复制相似问题