|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
hello, I am hoping once again for the support of the friendly YAF community with my programming troubles. I recently uploaded they YAF website on to my website VERSION of YAF: 1.9.3 beta hosting platform: CrystalTech Windows shared hosting WHAT version of .NET framework: 2.0 Error: Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 106: this.Controls.AddAt( 0, _header ); Line 107: Line 108: this.Controls.Add( forumControl ); Line 109: Line 110: // add the footer control after the page...
Source File: d:\Inetpub\pwnconclave\App_Code\YAF\Forum.cs Line: 108
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] YAF.Classes.Config.get_ConnectionString() in Config.cs:94 YAF.Classes.Data.YafDBConnManager.InitConnection() in DBAccess.cs:50 YAF.Classes.Data.YafDBConnManager..ctor() in DBAccess.cs:41 YAF.Classes.Base.ForumPage.InitDB() in ForumPage.cs:298 YAF.Classes.Base.ForumPage.ForumPage_Init(Object sender, EventArgs e) in ForumPage.cs:177 System.Web.UI.Control.OnInit(EventArgs e) +99 System.Web.UI.UserControl.OnInit(EventArgs e) +74 System.Web.UI.Control.InitRecursive(Control namingContainer) +321 System.Web.UI.Control.AddedControl(Control control, Int32 index) +221 System.Web.UI.ControlCollection.Add(Control child) +146 YAF.Forum.Forum_Load(Object sender, EventArgs e) in d:\Inetpub\pwnconclave\App_Code\YAF\Forum.cs:108 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Control.LoadRecursive() +131 System.Web.UI.Control.LoadRecursive() +131 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
Version Information: Microsoft .NET Framework Version:2.0.50727.1434; ASP.NET Version:2.0.50727.1434 Link: www.pwnconclave.com I am not sure whether this problem is being caused due to my connection string to the database being incorrect, my database is clean and new and has nothing on it, but it most probably is a problem with my forum being unable to connect to the database. My connection string: <connectionStrings> <add name="yafnet1" connectionString="data source=(local);initial catalog=yafnet;integrated security=SSPI" /> <add name="YYFConnectionString" connectionString="Provider=SQLOLEDB; Data Source=yaf; Initial Catalog=data_source_name; User ID=xxxx; Password=xxxx;network=dbmssocn AttachDbFilename=|DataDirectory|\YYF.mdf;Integrated Security=True;User Instance=True" /> </connectionStrings>I hope someone does have the time to help me out. Thank you! vnchopra
|
|
|
 Rank: YAF MVP

Joined: 2/12/2005 Posts: 923 Location: Italy
|
Your connection string is a bit messed up. ConnectionStrings.com have a connection string list for almost every DB on the Planent! Have a look. If you are... 1 - attaching the DB file 2 - using integrated security ...it should look like this... Code:
<connectionStrings> <add name="yafnet1" connectionString="data source=(local);initial catalog=yafnet;integrated security=SSPI" /> <add name="YYFConnectionString" connectionString="Provider=SQLOLEDB; Server=MyServerName; AttachDbFilename=|DataDirectory|YYF.mdf; Database=yaf; Integrated Security=True; Trusted_Connection=Yes;"/> </connectionStrings>
HTH  .....the man in black fled across the desert..........and the gunslinger followed.....
|
|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
Thank you for replying, i was beginning to think my question was not worthy of answering. I will try the changes you have suggested and will get back to you  I was wondering, is this line of code really an error? Line 108: this.Controls.Add( forumControl );
|
|
|
 Rank: YAF MVP

Joined: 2/12/2005 Posts: 923 Location: Italy
|
Well, as a wise man once said A Wise Man! wrote:There is no such thing as a stupid question.....just a stupid answer! So don't be afraid to ask. Just keep in mind, we all have day jobs. The answer might take awhile.  .....the man in black fled across the desert..........and the gunslinger followed.....
|
|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
Being a student, i dont think i would ever consider an answer to be a stupid answer. lol! Im glad you are replying back. im trying to get an internship as a web developer at a local company near by, you probably have an idea as to what a company is looking for in an intern, maybe you can give me some advise  I have another stupid question, i am using visual studio 2008, when i upload this website to my host, should i "Publish" it on my webhost? This would create a precompiled file, i actually do not know what to do with that.
|
|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
I tried your suggestion on changing the connection string and i still just get this error
Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 106: this.Controls.AddAt( 0, _header ); Line 107: Line 108: this.Controls.Add( forumControl ); Line 109: Line 110: // add the footer control after the page...
With the line in red highlighted. Do you still think its a connection string problem?
|
|
|
 Rank: YAF MVP

Joined: 2/12/2005 Posts: 923 Location: Italy
|
If you can diretly access your server, manually attach the database using SQL Server Management Studio. Then change your connection string to... Code:
<connectionStrings> <add name="yafnet" connectionString="data source=YOURSERVERNAME; initial catalog=YOUR_DB_NAME; integrated security=True" /> </connectionStrings>
Make sure you add access rights for the account accessing the DB through IIS. Usually it's the NT AUTHORITY\NETWORK SERVICE account. If you keep it as simple as possible, you can find errors faster!  Once you get the site running, then start adding to the connection string. Peice by peice to add the settings you need. As far as what design companies are looing for, that can't be answered directly. Each company uses there own "set of rules" to match their style. If your wanting to be a coder, best things to do is get as many languages under your belt as you can. Just make sure that you can program like a demon in your choosen primary language! .....the man in black fled across the desert..........and the gunslinger followed.....
|
|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
That would be nice but i dont have SQL Server Management studio, but i do have SQL server Management studio express, it does not seem to allow me to access a database server outside of my local computer.
By the way, what were you saying about once i have the website running?
|
|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
lol to be honest with you i have never really posted websites online before with a database in place, so this really is my first time doin that.
|
|
|
 Rank: YAF MVP

Joined: 2/12/2005 Posts: 923 Location: Italy
|
Can you get a valid example of what your connection string should look like from your ISP? They may require something "different". .....the man in black fled across the desert..........and the gunslinger followed.....
|
|
|
Rank: Advanced Member
Joined: 2/10/2006 Posts: 33 Location: North Carolina, USA
|
I got this same error and after downloading the source I found 2 problems. The root cause of the issue was that yaf was trying to insert a new user with a null gender. I changed the gender to nullable in the DB to get around the issue. The second problem is that the code was catching the exception and then returning 0 for the userId it was trying to create. Catching the exception and logging it is fine, but it should be rethrowing the exception instead of returning 0. This may not be your exact problem, but it was for me.
|
|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
I will tell you the suggested connection string asap.
As for the error, did you get exactly the same error message as i did?
|
|
|
Rank: Advanced Member
Joined: 2/10/2006 Posts: 33 Location: North Carolina, USA
|
Yes I did, but the real exception is hidden because of improper exception handling. Check the Eventlog table to see if the 'real' exception is being logged when you get the exception mentioned above.
|
|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
i will look for the event log table and tell you guys as soon as possible. I am so sorry if i have been replying late lately.
|
|
|
Rank: Member

Joined: 8/9/2008 Posts: 28 Location: NY, USA
|
are you guys still there?
|
|
|
| Users browsing this topic |
|
Guest
|