加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 无法找到类型或命名空间名称’ProfileCommon'(在

发布时间:2020-12-16 07:19:58 所属栏目:asp.Net 来源:网络整理
导读:我知道它之前已被问过,但没有一个对我有效,而我的有点不同. 我的MVC 4项目在本地工作但在服务器中无法运行此错误: Compiler Error Message: CS0246: The type or namespace name 'ProfileCommon' could not be found (are you missing a using directive or
我知道它之前已被问过,但没有一个对我有效,而我的有点不同.

我的MVC 4项目在本地工作但在服务器中无法运行此错误:

Compiler Error Message: CS0246: The type or namespace name 'ProfileCommon' could not be found (are you missing a using directive or an assembly reference?)

Source Error:


Line 194:        }
Line 195:        
Line 196:        protected ProfileCommon Profile {
Line 197:            get {
Line 198:                return ((ProfileCommon)(this.Context.Profile));

Source File: c:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Filesroote3c4a897ff4f4317App_Web_pageheader.ascx.cdcab7d2.rpk2croq.0.cs    Line: 196

我编写了一个自定义ProfileProvider并配置项目以使用它:

<profile enabled="true" defaultProvider="sql">
  <providers>
    <clear />
    <add name="sql" type="BusinessLogic.ProfileProvider" connectionStringName="c" applicationName="/" />
  </providers>
</profile>

我使用ProfileBase类来访问用户配置文件而不是ProfileCommon.上面的错误是在编译器生成的文件中.为什么asp.net生成一个无法编译的代码?为什么它在本地工作?

我在本地安装了.Net Framework 4.5.1,但在服务器中它是4.5.它与问题有关吗?

解决方法

当我们从Web站点项目迁移到Web应用程序项目时,我的部署中发生了同样的事情(尽管WebForms使用WebAPI服务).

我们的解决方案是从服务器上的已部署文件夹中删除PrecompiledApp.config,然后重新启动IIS.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读