Link to home
Start Free TrialLog in
Avatar of viola123

asked on

Help!!-- complie error when deploy my web site on web server!!

I upload my website to our web server. but there is a problem when i try to display the first page:

Server Error in '/' Application.

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

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

Source Error:

public partial class ClientDetails : System.Web.UI.Page
    private bool isFirst = false;    
    private ServerConnection conn = null; //***Error in this line

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Note: the "ServerConnection" is a classname. i tried to use the methods of this class. so i created an instance of this class.

the application is compiled successfully and runned successfully on my local machine.

Do you know how to solve this issue?

Avatar of nedfine
Flag of India image

Sounds like it can't find the code on the web server you are running it on.
Find the DLL that holds the class and make sure it is in the same directory location on the server as you are calling it from when compiling on your workstation.
Is the DLL that contains ServerConnection referenced to your site?  It needs to be.
Avatar of viola123


it compiled successfully on my local machine. the class file "ServerConnection.cs" is included in App_Code folder.  
I copied everything of this website from my local computer to the webserver.  and i tried to move all class files from App_code folder to the root directory, the compile error is still popped up.

Do you have any idea?

Try compiling ServerConnection.cs as a DLL, then putting that in the bin/ folder.

that means i have to create a class library project and compile it to a .dll. i really don't want to do that.
is there other ideas?

should i create a new namespace and add the class to this namespace? and then reference this namespace in my code behind file.

>should i create a new namespace and add the class to this namespace? and then reference this >namespace in my code behind file.

That seems like it might work.
i solved this issue.
i did not change the property of this website to "application" in IIS.
so in Directory>>Application Settings, create an application name for this website.

thanks a lot
Avatar of Computer101
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial