【转载】第一次WCF部署成功心得(UP+证书)
2011-12-06 17:07
423 查看
代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
namespace AthleticService
{
public class MathOperation : IMathOperation
{
#region IMathOperation 成员
public int Add(int x, int y)
{
return x + y;
}
#endregion
}
public class MyCustomValidator : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (string.IsNullOrEmpty(userName))
throw new ArgumentNullException("userName");
if (string.IsNullOrEmpty(password))
throw new ArgumentNullException("password");
if (userName != "admin" || password != "123456")
throw new SecurityTokenException("用户名或者密码错误!");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
namespace AthleticService
{
public class MathOperation : IMathOperation
{
#region IMathOperation 成员
public int Add(int x, int y)
{
return x + y;
}
#endregion
}
public class MyCustomValidator : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (string.IsNullOrEmpty(userName))
throw new ArgumentNullException("userName");
if (string.IsNullOrEmpty(password))
throw new ArgumentNullException("password");
if (userName != "admin" || password != "123456")
throw new SecurityTokenException("用户名或者密码错误!");
}
}
}
相关文章推荐
- 第一次WCF部署成功心得(UP+证书)
- 关于推送证书配置第一次失效,第二次重新配置成功的研究
- WCF部署:让IIS有权限访问证书文件
- WCF部署到IIS:证书必须具有能够进行密钥交换的私钥,该进程必须具有访问私钥的权限
- VS2005网站和SQL一起打包部署安装心得【转载】
- WCF开发框架之证书加密使用说明书(转载)
- wcf采用证书认证。。CS篇 转载而来
- WCF wsHttpBinding协议和x509证书创建和部署
- 第一次写博客,以后旨在翻译或者转载一些国外的技术文档,加上自己的实验心得,谢谢支持
- 第一次部署成功双网卡绑定
- WCF去掉证书验证(转载)
- apache+tomcat+Jfinal 2.2+dubbo2.5.4+zookeeper3.3.6 +redis+druid 分布式(集群)部署成功的一点心得(二)
- [转载]windows2003上IIS+PyISAPIe1.1..0部署成功
- 如何让带证书的WCF服务 部署在以network service 帐户运行的Windows Service中 原创
- 成功部署DUCK‘Bank 实例的心得
- 【转】如果是初学C语言请看完 一些成功人士的心得转载的文章
- 解决WCF部署到IIS出现“证书必须具有能够进行密钥交换的私钥,该进程必须具有访问私钥的权限”
- 转载:如果是初学C语言请看完 一些成功人士的心得
- apache+tomcat+Jfinal 2.2+dubbo2.5.4+zookeeper3.3.6 +redis+druid 分布式部署成功的一点心得(一)
- 【转载】Silverlight 应用 WCF RIA Services 在 IIS6 部署问题总结