poultarp
asked on
ASP.NET C#: "object reference not set to an instance of an object" in ASPNETCOMPILER
Hi
I have a website made in VS 2012. The site builds, complies and runs without problem on my localhost. However, when I try and publish the website I get this error:
"Oject reference not set to an instance of an object" in the file ASPNETCOMPILER.
I have searched the net for a solution, and I have found various solutions, but non of them have worked.
Here are some of the things I have tried so far:
- Deleting all dll files in the Bin folder with the extension .Compiled
- Deleting all dll files in the Bin folder with the extension .Refresh
- Disabling my anti virus
- Trying to compile the website from another computer
- Moving the website from the development server to my local computer and publish it from there
Anyone else how have had this problem and found a solution not mentioned above?
Thanks in advance.
I have a website made in VS 2012. The site builds, complies and runs without problem on my localhost. However, when I try and publish the website I get this error:
"Oject reference not set to an instance of an object" in the file ASPNETCOMPILER.
I have searched the net for a solution, and I have found various solutions, but non of them have worked.
Here are some of the things I have tried so far:
- Deleting all dll files in the Bin folder with the extension .Compiled
- Deleting all dll files in the Bin folder with the extension .Refresh
- Disabling my anti virus
- Trying to compile the website from another computer
- Moving the website from the development server to my local computer and publish it from there
Anyone else how have had this problem and found a solution not mentioned above?
Thanks in advance.
Does your project use any third-party libraries that may be missing from your production server?
ASKER
@AndyAinscow
The problem is not when I build, complie or run the website, the error comes when I publish the website.
I can even copy the entire website to the server and the site runs as it should. I just need to be able to publish it so I don't have to copy every single file to the webserver.
@Carl Tawn
I don't think so, but I will check up on it as soon as I get the chance.
The problem is not when I build, complie or run the website, the error comes when I publish the website.
I can even copy the entire website to the server and the site runs as it should. I just need to be able to publish it so I don't have to copy every single file to the webserver.
@Carl Tawn
I don't think so, but I will check up on it as soon as I get the chance.
>>the error comes when I publish the website.
Yes, that is what puzzles me a bit. It sounds like something is missing or the publishing tool has a bug.
Yes, that is what puzzles me a bit. It sounds like something is missing or the publishing tool has a bug.
Just to confirm: your project type is a web site or a web application?
There is some setting for publishing of website. The setting say to include files that are required by this website.
So I'm assuming that the compiler is not publishing some dll or the file that might be required for your website. I faced such issue when I published website with MySql.
The MySql.Web.dll depends on MySql.Data.dll file. But compiler wasn't publishing it for any reason. Therefore as hint to detect -
1. Build your project in release mode. As that is the by default mode for publishing too.
2. Cross-match files in Release folder with the published files.
3. I suspect that there might be some of files missing in published folder.
4. Copy those missing files in published folder.
5. Test your website. Should work fine if steps 1 to 4 matched.
So I'm assuming that the compiler is not publishing some dll or the file that might be required for your website. I faced such issue when I published website with MySql.
The MySql.Web.dll depends on MySql.Data.dll file. But compiler wasn't publishing it for any reason. Therefore as hint to detect -
1. Build your project in release mode. As that is the by default mode for publishing too.
2. Cross-match files in Release folder with the published files.
3. I suspect that there might be some of files missing in published folder.
4. Copy those missing files in published folder.
5. Test your website. Should work fine if steps 1 to 4 matched.
ASKER
@kaufmed
Im 99% sure the type is a Web site. Anywhere I can confirm this?
@Vikram
No files are put in my publish folder - the error comes before any files are created.
Im 99% sure the type is a Web site. Anywhere I can confirm this?
@Vikram
No files are put in my publish folder - the error comes before any files are created.
Can you post the full build log from when you try and publish? i.e. the contents of the "Output" window.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you looked within ExpertsExchange for this error you will find hundreds if not thousands of hits.
Basically it is the following where X is for example a class type.
X x; //x has a default value of null - it does not exist
x.DoSomething(); //error
and the solution is simple
X x = new X(); //create an instance of X
x.DoSomething(); //is OK because x has been created