Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
670 views
in Technique[技术] by (71.8m points)

asp.net - Could not load the assembly 'App_Web_kh7-x3ka'. Make sure that it is compiled before accessing the page

I can't seem to figure out what I am doing wrong here. I publish my website to my server and when I try to run it I get the following exception:

Could not load the assembly 'App_Web_kh7-x3ka'. Make sure that it is compiled before accessing the page.

Has anyone else ever encountered this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This can also happen when you've taken a pre-compiled aspx page and edited it as if uncompiled, such as copying it from the Live server and overwriting your dev/working version.

On the first line of your aspx page within the <%@Page /> tag you'll probably see an attribute like:

inherits="yourPageClass, App_Web_kh7-x3ka".

Delete the "App_Web_XXXX" part and add the CodeFile attribute pointing to your code behind file:

CodeFile="yourPageFile.aspx.cs"

The <%@Page /> tag should now look similar to when you create a new page from scratch.

When your Asp.Net pages are precompiled for release to the production server, references to the code behind are replaced with references to the compiled DLLs which have the App_Web_XXXX name.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...