virtual directory site not using new database in DNN - dotnetnuke

I created a virtual directory for my dnn site which uses new database steps are as follows
right click on site -> add virtual directory
copied all file from dnn site to virtual directory folder
runs the site it woks file
create backup of old sql database (which are used by dnn site)
create new database in sql and restore old database backup on it
changed the connection string of web.config file
runs the site but its not using new database (using old database)
I want to know what changes I need to do my virtual directory so that it uses new database please guide me
Thanks

If you are running it in a sub-directory or new virtual directory make sure your PortalAlias table in your SQL database has the proper URL in it. There are two spots in your web.config file that the database needs to be changed. That is the only place that your database connections will be. Recycle your application pool / restart IIS / restart your DNN application in the HOST menu just to make sure it is all cleared up and it is referencing your web.config file (even though just saving the web.config with different info should have been sufficient)
But the web.config file is the only place the database connections would be, if you have a web.config file higher up (above your virtual directory) it could be affecting your web.config in a sub directory.

Related

Access to SQL Server FileTable from IIS

After creating filetable I've got a shared folder
\\<my domain>\mssqlserver\<filestream directory>\<my table>
I've made all nesessary settings in SqlServer Configuration manager to make it available and added couple of files with database stored proc.
I made virtual folder for my web site
http://localhost/<my ewb site>/<virtual folder>/
referencing shared table folder.
When I try to get file from folder I get en error:
HTTP 500.19 - Internal Server Error
Code 0x80070032
I found something in answer of this question
Access Denied when inserting file into Sql Server 2012 FileTable using File.CreateFile in ASP.NET website
But it's only a database part of configuring.
I don't understand how to configure IIS and virtual folder to grant access to shared folder.
Not sure if this is relevant to your situation, but I came across the same problem. 2 out of 3 sites that I setup worked fine with the UNC path virtual directory pointing to the SQL filetable share, but the 3rd site got the error above. The reason was because this site was had both IIS and SQL on the same server, and using the server name in the UNC path was causing a reparse and checking for directory change notifications, which mentioned in the comments above aren't supported by SQL. So I changed the UNC path to use localhost instead of the server name and it worked! So, instead of:
\\<my domain>\mssqlserver\<filestream directory>\<my table>
use:
\\localhost\mssqlserver\<filestream directory>\<my table>

How to reconnect VB Application to the Database

Like a month earlier, I had installed a Forms Over Data (VB2010) application to a user but unfortunately they've lost the computer. Luckily, they had backed up the Data folder with the .MDF and .ldf to a CD. I want to reinstall the app to their new computer. How will I reconnect their database to the new app and enable them to "Resume from where they left"?
Find (or install) Sql Server 2008 on the client machine. We'll call this MySqlServer\MyInstanceName.
Attempt to "attach" the mdf/ldf to MySqlServer\MyInstanceName. Cross your fingers and hope for the best. We'll say you restored it as MyDataBaseName.
If that works...then... You now have a db that "exists".
Hopefully, the devs put the connection string in a .config file. Do a search in the directory where the application is deployed. Search for *.config
Change the connection-string to reflect MySqlServer\MyInstanceName and MyDataBaseName. You can look at the URL below for permutations.
http://www.connectionstrings.com/sql-server/

Creating virtual directory in IIs for dnn website which uses new database

I want to create virtual directory for my dnn website which uses new database, for this I followed these steps.
go to iis server manager right click on site and click on add virtual directory
then I copied all file from dnn site to virtual directory folder and runs on browser it runs fine
after that I created new database and restore the backup of old database(which are used by Dnn website) on it . and change the connection string of virtual directory web.config file, it shows error "Invalid login" then I created new login in sql server and checked db_owner Properties of new database.
but when i browse site one issue occurring "Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects."
so I want to know is these steps are right? if right then, how can i resolve this problem .
If any one have an idea please guide me
Thanks
You will need to update the PORTALALIAS in the restored Database in order to get the site working. Your PortalAlias should match the URL of the virtual directory.

How does the ClickOnce installer handle updates when a compact database is involved?

I have a simple WPF application that uses ClickOnce to handle installing. Within this application is a compact database. Through testing I have found that when I publish a new build this database will get overwritten, which is not what I want. Is there anyway I can have fine grained control over what files are updated? I assume ClickOnce is simply checking the hash of the database file, deciding that it has changed and pulling the update.
As a workaround I have since removed the database from the files that are included with the published application so the original remains on the client machine after an update, untouched.
Not a great solution I know
Thanks,
ClickOnce deployments segregate the Application Files into "Include" or "Data file". You can specify what each file is in visual Studio by going to the project Properties page, Publish tab, then clicking the "Application Files..." button. You can then set your .sdf file to "Data File" under the Publish Status column.
Data Files that are downloaded with a ClickOnce application are then placed in a separate directory for each new version.
The idea is that on the first run of the new application version, you go retrieve all the user's private data from their old-version data files and incorporate that data into the new data files which have just been downloaded with your new version.
I think you'll find the information you need at Accessing Local and Remote Data in ClickOnce Applications. Specifically, look at the sections "ClickOnce Data Directory" and "Data Directory and Application Versions."
To access a SQL Server CE database located in your Data directory, use a connection string similar to the following:
<add
name="MyApplication.Properties.Settings.LocalCacheConnectionString"
connectionString="Data Source=|DataDirectory|\LocalCache.sdf"
providerName="Microsoft.SqlServerCe.Client.3.5" />
The "|DataDirectory|" is a special syntax supported by SQL CE and SQL Express and resolves at runtime to the proper directory.
If you so much as open that SQLCE database included in your project, it will change the time stamp on the database, and ClickOnce will deploy it and put the old version under the \pre subfolder.
You might want to consider this method for handling this. Then if you accidentally deploy a new version of the database and don't realize it, you're not hosed. If you intentionally make changes, you can change the database structure of your current database with SQL queries, and pull data from the new copy deployed to the Data Directory (that you're otherwise ignoring) when you need to.
RobinDotNet

How do you export settings from the Database Publishing Wizard?

I'm using the Database Publishing Wizard in VS2008 to push changes to my hosting provider. It doesn't look like those settings go with the project (which seems a little silly to me), but rather they go with the machine.
On each new machine that I'd like to publish from I need to go through the process of digging up my database settings.
Is there a way to backup/export/save these settings to a file?
If so, what is it?
Hmmm ... it appears that the publishing wizard uses 2 config files for it's application configuration:
The Publish Database Wizard uses the
files user.config and hoster.config to
store configuration information. The
directory in which these files are
stored must have the appropriate NTFS
file system permissions set. These
files contain user names and encrypted
passwords. The passwords are encrypted
by using DPAPI.
user.config File
This file stores persisted host and
configuration settings for the Publish
Database Wizard. The user.config file
is located at %SystemDrive%\Documents
and Settings\%Username%\Application
Data\Microsoft\Microsoft SQL
Server\90\Tools\Publishing
Wizard\user.config.
hoster.config File
This file stores options about Web
service addresses, user names, and
databases for shared hosting
providers. The hoster.config file is
located at %SystemDrive%\Documents and
Settings\%Username%\Application
Data\Microsoft\Microsoft SQL
Server\90\Tools\Publishing
Wizard\hoster.config.
I'm trying to access these files in Vista (with VS2008 and SQL Express installed) and striking out. I'll keep you posted.
Update: Looks like I didn't have the Publishing Wizard installed after all. After grabbing the version for VS2008 here, and then installing (and don't worry -- you won't see any indication it's getting installed, but it does).... and THEN setting up my first database using the wizard, it looks like there are indeed some settings stored uder the 'Application Data' directory listed above. However, it looks like it's just a user.config, and then an XML file for each database configured. I believe you can backup each of these files for later use.

Resources