开发者

ASP.NET error after uploading project to server

after uploading my project to server i am getting following error please let me know what is the following error

CS0433: The type 'Course' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\assembly\dl3\afaf3b67\f1871969_3e5bcb01\App_Code.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\assembly\dl3\29fd4e0e\f1751c7e开发者_如何学Go_3e5bcb01\App_Web_spb4jssk.DLL'

and

Line 111:    [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 112:    public class admin_course_aspx : global::Course, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
Line 113:        
Line 114:    private static bool @__initialized

and

Source File:  c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\672b2bdf\9fb2ad98\App_Web_course.aspx.fdf7a39c.gdurkajz.0.cs
Line: 112


It looks like you may have a Web Site, and not a Web Application Project.

For a Web Site, you get a lot of arbitrarily named .DLLs, such as your "App_Web_spb4jssk.DLL" above. These names are different every time you compile.

What's probably happening is that when you add your new dlls to your production server, the old one (with a different name) is still there, and contains the same class names as your new ones.

What you have to do is delete everything in the bin directory of your production server before you upload your new ones.

Ideally, what you should do is convert your web site to a Web Application Project.


Update:

Here is an article that describes how to convert a website into a web application project. It's specific to VS2005, but the steps are basically the same for VS2008 and VS2010.

The difference between a website and a web application project is that in a web application there is a project file that keeps track of all the files and settings for your website, just like for any other Visual Studio project. A web application will also compile your entire site into just one dll.

If you have a web site that doesn't have a project file, it doesn't explicitly know how you want to compile your website, so it ends up creating a bunch of separate dll files with random names.


I would also recommend what Claudio says. However, you may want to double check that you don't have any source files in the App_Code directory that were erased in your local copy (as they were moved into a different DLL)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜