我用任何错误构建了我的整个应用程序但是当我在chrome中运行我的项目时出现了这个错误:
StructureMap异常代码:208
请求类型在StructureMap中未配置NoteSeal.NoteSealCoreWeb.Core.IProfileAttributeService
描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:StructureMap.StructureMapException:StructureMap异常代码:208 请求的类型NoteSeal.NoteSealCoreWeb.Core.IProfileAttributeService未在StructureMap中配置
来源错误:
Line 21: _profileRepository = ObjectFactory.GetInstance<IProfileRepository>();
Line 22: _profileAttributeRepository = ObjectFactory.GetInstance<IProfileAttributeRepository>();
Line 23: _profileAttributeService = ObjectFactory.GetInstance<IProfileAttributeService>();
Line 24: _levelOfExperienceTypeRepository = ObjectFactory.GetInstance<ILevelOfExperienceTypeRepository>();
Line 25: _userSession = ObjectFactory.GetInstance<IUserSession>();
这是全班:
namespace NoteSeal.NoteSealCoreWeb.Core.Impl
{
[Pluggable("Default")]
public class ProfileService : IProfileService
{
private IProfileRepository _profileRepository;
private IProfileAttributeRepository _profileAttributeRepository;
private IProfileAttributeService _profileAttributeService;
private ILevelOfExperienceTypeRepository _levelOfExperienceTypeRepository;
private IUserSession _userSession;
public ProfileService()
{
_profileRepository = ObjectFactory.GetInstance<IProfileRepository>();
_profileAttributeRepository =
ObjectFactory.GetInstance<IProfileAttributeRepository>();
_profileAttributeService = ObjectFactory.GetInstance<IProfileAttributeService>();
_levelOfExperienceTypeRepository =
ObjectFactory.GetInstance<ILevelOfExperienceTypeRepository>();
_userSession = ObjectFactory.GetInstance<IUserSession>();
}
public Profile LoadProfileByAccountID(Int32 AccountID)
{
Profile profile = _profileRepository.GetProfileByAccountID(AccountID);
List<ProfileAttribute> attributes = new List<ProfileAttribute>();
LevelOfExperienceType levelOfExperienceType;
if (profile != null && profile.ProfileID > 0)
{
attributes =
_profileAttributeService.GetProfileAttributesByProfileID(profile.ProfileID);
levelOfExperienceType =
_levelOfExperienceTypeRepository.
GetLevelOfExperienceTypeByID(profile.LevelOfExperienceTypeID);
profile.Attributes = attributes;
profile.LevelOfExperienceType = levelOfExperienceType;
}
return profile;
}
public void SaveProfile(Profile profile)
{
Int32 profileID;
profileID = _profileRepository.SaveProfile(profile);
foreach (ProfileAttribute attribute in profile.Attributes)
{
attribute.ProfileID = profileID;
_profileAttributeRepository.SaveProfileAttribute(attribute);
}
_userSession.CurrentUser.Profile =
LoadProfileByAccountID(_userSession.CurrentUser.AccountID);
}
}
}
有谁知道为什么在本文档中出现此错误