None of my “code behind” code is being called

前端 未结 9 1905
予麋鹿
予麋鹿 2021-02-08 00:40

I have just created an ASP.NET C# project and a virtual directory for it in IIS in (as far as I know) the normal way, but I am seeing very strange behavior that I have never see

9条回答
  •  伪装坚强ぢ
    2021-02-08 01:04

    This appears to be a namespace issue as the dynamically compiled classes are colliding with the pre-compiled classes. I suggest doing the following:

    1) Select a reasonable namespace for your app. "Drawing" is fine, but I suggest something more contextual such as CompanyName.ProjectName.AppName

    2) Set this namespace as the default for the project (Project Properties > Application tab)

    3) Change the namespace in each and every code file (.cs) and its corresponding reference in script files (.aspx, *.ascx)

    4) Ensure that there are no duplicate classes (this should be flagged by the compiler)

    5) Purge all files from the temporary ASP.NET folder

    6) Recompile the project

提交回复
热议问题