您的位置:首页 > 其它

【转载】第一次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("用户名或者密码错误!");
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: