The type or namespace name 'ProfileCommon' could not be found (in the compiler generated code on the server)

I know this has been asked before, but none worked for me and mine, slightly different.

My MVC 4 project is running locally but on the server it won't start with this error:

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:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\e3c4a897\ff4f4317\App_Web_pageheader.ascx.cdcab7d2.rpk2croq.0.cs    Line: 196 

      

I wrote a custom ProfileProvider

and configured project to use it:

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

      

I am using a class ProfileBase

to access user profile ProfileCommon

. The error is above in the compiler generated file. why is asp.net generating code that it cannot compile? and why does it work locally?

I have .Net Framework 4.5.1 installed locally, but on a 4.5 server. is it related to the problem?

+3


source to share


1 answer


The same thing happened for me (albeit using WebForms with WebAPI services) in our deployment when we moved from a website project to a web application project.



In our case, the solution was to remove PrecompiledApp.config from the deployed folder on the server and restart IIS.

+7


source







All Articles