YAFLogo

Coleen
  • Coleen
  • 89.2% (Honored)
  • YAF Commander Topic Starter
12 years ago
I'm very new to Yaf.Net and am trying to get the latest version v1.9.6.1 RTW Binary (Install) Zipped from CodePlex installed on my local host in Visual Studios 2010. I've followed the installation instructions up to running in the DB Installation Wizard. I am getting this error on trying to connect to the existing connection string:

Failed to connect:

The database 'C:\INETPUB\WWWROOT\YAFTESTFORUMS\APP_DATA\DATABASE.MDF' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported. Could not open new database 'C:\INETPUB\WWWROOT\YAFTESTFORUMS\APP_DATA\DATABASE.MDF'. CREATE DATABASE is aborted. An attempt to attach an auto-named database for file C:\inetpub\wwwroot\YafTestforums\App_Data\Database.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Can anyone please help me with this? I do have MS SQL Server 2008. Any help would be greatly appreciated. TIA,

Coleen

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
12 years ago
The empty DB that is included with YAF was generated with SQL Server 2008 R2 thats why this DB doesn't work with your older SQL Server Version.

But you don't need this Data Base, you can delete that file 'C:\INETPUB\WWWROOT\YAFTESTFORUMS\APP_DATA\DATABASE.MDF.

You need to create a new Data base on your SQL Server and modify the db.config in yaf to connect to your sql Server and the new database (You can do this via the YAF Install Wizard)

Coleen
  • Coleen
  • 89.2% (Honored)
  • YAF Commander Topic Starter
12 years ago
Thanks for the response. Sorry I haven't replied - I've been off-line, sick with the flu!

Okay, so I deleted the file you said to delete and ran the Instal Wizard again. I get the error below:

Failed to connect:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

UserPostedImage

So I'm not sure where to go from here. Any help would be appreciated.

Thanks!

Coleen

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
12 years ago
You need to specify the Name of your database Server in the Data Source field, and Initial Catalog is the Database on the Server (Which you need to create if you haven't done already).
Coleen
  • Coleen
  • 89.2% (Honored)
  • YAF Commander Topic Starter
11 years ago
Okay, I'm working on this again and have tried to change the connection strings in the db.config - here is what I have in the db.config:

This is the error message I am getting now when I try to run the Install Wizard:

serviceLocator cannot be null

Parameter name: serviceLocator

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.ArgumentNullException: serviceLocator cannot be null

Parameter name: serviceLocator

I'm sorry, but I truly do not understand what/where I am supposed to be adding the Data Source field. If I can't do this through the Install Wizard, then how do I fix this? I honestly have like Zero experience with SQL Server....

Any help would be greatly appreciated.

squirrel
11 years ago
Is this a locally hosted site and SQL database (development) or are you trying to get this running on a web hosting server somewhere?

If you are trying to get it running on an SQL server in a hosting environment, you need the following:

Remote name or address of the SQL Server.

Name of the database you are trying to install to.

Username that has write permissions to the database (SQL database user) and the password for that user. DO NOT POST THE USERNAME OR PASSWORD HERE - you just need to know them for your connection string.. I will help with a connection string once we have a better idea how you are trying to install YAF (public hosted or on a 'local' computer for development)...

Then, you must modify the db.config with that information (and uncomment the lines as necessary).

The code you posted above has the remote SQL server line enabled, but written as you are using SQL server hosted on the machine trying to host the forum, with a default database name and integrated security - which generally does not work on hosted web applications. The other line won't work because that is for a 'flatfile' database located in your YAF folder.

In order for us to help much more, we need to atleast know your hosting configuration. Where and what are you trying to install YAF on. From there, I might be able to help with a connection string...


If you can't find it using the forum search, try my signature link -- searches this site using Google: Google is my Friend 
Coleen
  • Coleen
  • 89.2% (Honored)
  • YAF Commander Topic Starter
11 years ago
Thanks so much for the quick response! Currently, I'm trying to get this running on my local host for testing, before I move this up to my hosting service. I realize that the connection strings will have to change between the two, but I am hoping that once I am ready to move this to the host server, my hosting service can help me with the correct connection strings for their SQL Server. For now, I just want to get this running on my local host so I can test it and format it to match my website.

I'm using a PC, Windows 7, Visual Studios 2010, .Net Version 4.0.3xxx, Microsoft SQL Server 2008 - SQL Server Express.

Although I understand SQL basics (sort-of) I've never had to set up SQL server myself via connection strings. That used to all be done by the Network staff where I worked.. now that I work for myself, I have to learn all of this, and I admit I am confused...

Thanks again for your help,it truly is appreciated.

squirrel
11 years ago
In your SQL Management Console, you need to create an empty database.

Then you will need to create a login to the SQL server that supports 'SQL Authentication'. I also make the new database the 'default database' for that user login. You also need to assign db_owner rights to that user for that database. Please see Google for help setting up SQL Server Express (primarily in setting up an empty database and assigning it a user (and setting that user to the owner of that database)...

Then, you can use the SQLExpress connection string:


<connectionStrings>
<!-- Connection String for SQL Server 2005/2008 -->
<!-- add name="yafnet" connectionString="data source=(localhost);initial catalog=yafnet;integrated security=SSPI" / -->
<!-- Connection String for SQL Server 2005/2008 Express -->
<add name="yafnet" connectionString="Data Source=.\SQLExpress;User ID={your_db_user};Password={your_db_user_password};Trusted_Connection=False;database={database_name};" providerName="System.Data.SqlClient" />
</connectionStrings>

Replace the words inside the braces ( { } ) with your information - also remove those braces when you put your information in.


If you can't find it using the forum search, try my signature link -- searches this site using Google: Google is my Friend 
Coleen
  • Coleen
  • 89.2% (Honored)
  • YAF Commander Topic Starter
11 years ago
Thanks for your help. I was finally able to get MSSQL 2008 Express completely installed without any errors, created the new DB and was able to login with SQL Authentication. Then when I ran Yaf.Net and changed my db.config to use the connection string as you supplied, I am now getting this error:

Startup Error: YAF.NET is not setup properly. Please add the to the section of your web.config file

I have my custom errors turned off:

and here is my connection string (with my username and password x'd out):

I'm at a loss. Also, if I try to run the setup wizard through the install/default.aspx I get this error:

Server Error in '/YafTestForum' Application.

serviceLocator cannot be null

Parameter name: serviceLocator

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.ArgumentNullException: serviceLocator cannot be null

Parameter name: serviceLocator

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentNullException: serviceLocator cannot be null

Parameter name: serviceLocator]

YAF.Types.CodeContracts.ArgumentNotNull(T obj, String argumentName) +100

YAF.Types.Interfaces.IServiceLocatorExtensions.Get(IServiceLocator serviceLocator) +52

YAF.Classes.Data.MsSqlDbAccess.get_Current() +42

YAF.Install._default.Page_Init(Object sender, EventArgs e) +31

System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14

System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35

System.Web.UI.Control.OnInit(EventArgs e) +91

System.Web.UI.Page.OnInit(EventArgs e) +12

System.Web.UI.Control.InitRecursive(Control namingContainer) +140

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +480

I am truly at a loss as to what/where to go/do next. Any assistance would be greatly appreciated.

Thanks,

Coleen

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
11 years ago
Did you follow the install Guide?! looks like you are using a different web.config.

On the Install Guide  it says:

You need to copy the file recommended-NET-web.config to your yaf root Folder and rename it to web.config.

Coleen
  • Coleen
  • 89.2% (Honored)
  • YAF Commander Topic Starter
11 years ago
Hi Watcha - thank you!

I've had some major Internet connectivity issues in the past week so am just now getting back to this. You are right, I did not copy the recommended-NET-web.config file to my yaf root Folder and rename it to web.config, I have done that now and am running the wizard again. I had deleted the entire SQL database structure and started over with a clean slate - which seems to have worked, now that I have copied the web.config file correctly.

It did give me an error when it came to the screen to "Upgrade BBCode Extensions, File Extensions and Topic Status Lists" so I un-checked the box and just continued on. So far, so good. However, I do have a question about the email address/account.

I do have an email address associated with my website, but don't have one specifically set up for the forums. Do I just set up the mail in the web.config like I did with my website - only with the email address I just created for the forums? When I open the mail.config file, I get an error "The 'smtp' element is not declared." Honestly, I've never set up my email using a mail.config file - I've always set it in the web.config as follows:

So how do I declare the smtp element? Are there instructions somewhere on this? Any help would again be greatly appreciated. Thank you very much for all of your assistance.

Coleen

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
11 years ago

Hi Watcha - thank you!

I've had some major Internet connectivity issues in the past week so am just now getting back to this. You are right, I did not copy the recommended-NET-web.config file to my yaf root Folder and rename it to web.config, I have done that now and am running the wizard again. I had deleted the entire SQL database structure and started over with a clean slate - which seems to have worked, now that I have copied the web.config file correctly.

It did give me an error when it came to the screen to "Upgrade BBCode Extensions, File Extensions and Topic Status Lists" so I un-checked the box and just continued on. So far, so good. However, I do have a question about the email address/account.

I do have an email address associated with my website, but don't have one specifically set up for the forums. Do I just set up the mail in the web.config like I did with my website - only with the email address I just created for the forums? When I open the mail.config file, I get an error "The 'smtp' element is not declared." Honestly, I've never set up my email using a mail.config file - I've always set it in the web.config as follows:

So how do I declare the smtp element? Are there instructions somewhere on this? Any help would again be greatly appreciated. Thank you very much for all of your assistance.

Coleen

Originally Posted by: Coleen 

Simply open the mail.config delete all the content and replace it with your smtp content only...

<smtp>
       <network host="mail@mywebsite.com" port="25" userName="forums@mywebsite.com" password="xxxxxx"/>
    </smtp>

Coleen
  • Coleen
  • 89.2% (Honored)
  • YAF Commander Topic Starter
11 years ago
When I do that, just have this line in the mail.config file:

It gives me the error: "The 'mailSettings' element is not declared." and if I delete the tag and just use the tag, I get the same error: "The 'smtp' element is not declared." What am I missing? Do I even need to have a separate mail.config file? Can't I set the mail settings in the main web.config file? Thanks for any assistance, it truly is appreciated.

Coleen

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
11 years ago

When I do that, just have this line in the mail.config file:

It gives me the error: "The 'mailSettings' element is not declared." and if I delete the tag and just use the tag, I get the same error: "The 'smtp' element is not declared." What am I missing? Do I even need to have a separate mail.config file? Can't I set the mail settings in the main web.config file? Thanks for any assistance, it truly is appreciated.

Coleen

Originally Posted by: Coleen 

No you don't need the mail.config. You can modify the web.config.

The standard web.config from yaf looks like this

<mailSettings>
			<smtp configSource="mail.config" />
		</mailSettings>

but you can change it like you wrote above

<mailSettings>
<smtp>
<network host="mail@mywebsite.com" port="25" userName="forums@mywebsite.com" password="xxxxxx"/>
</smtp>
</mailSettings>

Coleen
  • Coleen
  • 89.2% (Honored)
  • YAF Commander Topic Starter
11 years ago
Thank you! That's what I thought, but since I'm new to YAF.Net and haven't used MVC, I wanted to be sure there wasn't something I was missing. Thanks again for all of your help, it is much appreciated!