之前在Web上用是OK的.现在在控制台程序中调用.
我的App.config <profile enabled="true" defaultProvider="SqlProfileProvider" inherits="Sof.Model.Sof.EclProfileCommon">
<providers>
<clear/>
<add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="SofDBConnection" applicationName="CY2008APP"/>
</providers>
<!--<properties>
<add name="Account" type="Sof.Model.Sof.EclProfileCommon" serializeAs="Binary" allowAnonymous="true"/>
</properties>-->
</profile>
profile的扩展Sof.Model.Sof.EclProfileCommon的定义:namespace Sof.Model.Sof
{
/// <summary>
/// Profile
/// <res>继承ProfileBase的类,用来处理Profile扩展信息封装在BLL里使用的派生类</res>
/// </summary>
public class EclProfileCommon : ProfileBase
{
[SettingsAllowAnonymous(true)]
[ProfileProvider("SqlProfileProvider")]
public Account Account
{
get { return (Account)base["Account"]; }
set { base["Account"] = value; }
} }
}
其他类库工程里调用这里出错了(以前用Web调用的时候,这儿是正确的) EclProfileCommon p = (EclProfileCommon)ProfileBase.Create(_userName);
错误如下:
Could not load type 'Sof.Model.Sof.EclProfileCommon' from assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.很搞不懂.为啥要去System.Web加载那个对象里.分不够再加
我的App.config <profile enabled="true" defaultProvider="SqlProfileProvider" inherits="Sof.Model.Sof.EclProfileCommon">
<providers>
<clear/>
<add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="SofDBConnection" applicationName="CY2008APP"/>
</providers>
<!--<properties>
<add name="Account" type="Sof.Model.Sof.EclProfileCommon" serializeAs="Binary" allowAnonymous="true"/>
</properties>-->
</profile>
profile的扩展Sof.Model.Sof.EclProfileCommon的定义:namespace Sof.Model.Sof
{
/// <summary>
/// Profile
/// <res>继承ProfileBase的类,用来处理Profile扩展信息封装在BLL里使用的派生类</res>
/// </summary>
public class EclProfileCommon : ProfileBase
{
[SettingsAllowAnonymous(true)]
[ProfileProvider("SqlProfileProvider")]
public Account Account
{
get { return (Account)base["Account"]; }
set { base["Account"] = value; }
} }
}
其他类库工程里调用这里出错了(以前用Web调用的时候,这儿是正确的) EclProfileCommon p = (EclProfileCommon)ProfileBase.Create(_userName);
错误如下:
Could not load type 'Sof.Model.Sof.EclProfileCommon' from assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.很搞不懂.为啥要去System.Web加载那个对象里.分不够再加
解决方案 »
- 分页过程的问题????
- 求一段代码,判断用户在登录页面输入的验证码是否正确。 急!!!
- 请问sql语句来获取两个日期间的数据怎么写?
- 如何让GridView不换行?
- 【请问这里方法中, 怎么返回一个int的值】-------------------------------------------------------------------- up有分
- 在javascript中怎样用正则表达式呀?
- 请帮帮忙 一个简单的问题
- 在三层结构中下面这几层应该归于哪一层啊?谢谢.
- 如何为web控件编写Javascript程序,让其首先在客户端检查?如果检查成功再执行服务器端的程序?
- web.confing 配置问题?
- asp.net模板页 js获取绝对位置的问题 很急!!!在线等待!!!
- |zyciis| 如果 判断我是否已经 注册了 ScriptManager.RegisterClientScriptBlock
<add name="Account" type="Sof.Model.Sof.EclProfileCommon" serializeAs="Binary" allowAnonymous="true"/>
</properties>-->这里为什么注掉啊type="Sof.Model.Sof.EclProfileCommon" 要写全名System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
这样形式的,namespace+classname,assembly name,.....Could not load type 'Sof.Model.Sof.EclProfileCommon' from assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
所以会报这个错,默认去system.web这个程序集中去找你的那个类啊
等待接分,呵呵
<add name="Account" type="Sof.Model.Sof.EclProfileCommon" serializeAs="Binary" allowAnonymous="true"/>
这个也有同样的问题