0
我试图实现授权作为Seroter描述here(服务授权部分)。我已经GAC了图书馆,更改了machine.config
并能够在选择行为扩展对话框中选择自定义行为。但我不能设置'WindowsGroup'的值,它给了我“对象引用没有设置为对象的实例”,我不明白为什么。有没有人实施服务授权?BizTalk服务授权
我试图实现授权作为Seroter描述here(服务授权部分)。我已经GAC了图书馆,更改了machine.config
并能够在选择行为扩展对话框中选择自定义行为。但我不能设置'WindowsGroup'的值,它给了我“对象引用没有设置为对象的实例”,我不明白为什么。有没有人实施服务授权?BizTalk服务授权
终于解决了这个问题。
using System;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace Esb.Service.Authorization
{
public class EsbBehaviorElement : BehaviorExtensionElement
{
private const string _windowsgroupIndexName = "windowsgroup";
public EsbBehaviorElement()
{
if (!base.Properties.Contains(_windowsgroupIndexName))
{
base.Properties.Add(new ConfigurationProperty(_windowsgroupIndexName, typeof(string)));
}
}
[ConfigurationProperty("WindowsGroup", IsRequired = false, DefaultValue = "")]
public string WindowsGroup
{
get
{
return (string)base[_windowsgroupIndexName];
}
set
{
base[_windowsgroupIndexName] = value;
}
}
public override Type BehaviorType
{
get
{
return typeof(EsbServiceBehavior);
}
}
protected override object CreateBehavior()
{
return new EsbServiceBehavior(WindowsGroup);
}
}
}
我不知道为什么Seroter的解决方案作品,未经构造函数,其中一个应该“windowsgroup”属性添加到属性的基本集合。
感谢您发布解决方案! – StuartLC