SQL Server 2008 Database Changing Read Only state to 'True' After Deployment - visual-studio-2010

I'm creating a Installation Setup for one of my applications using visual studio setup project in VS2010. In which I'm accessing my database from application folder. I have added both MDF and LDF files to Data folder in Application folder.
Everything works fine and I'm able to install the application, but when opening the application I'm getting an error saying 'Cannot update database because its read-only'. I have checked the database with SSMS and see that the Read-only flag is set to True by default and database is showing in gray color. After change the read only property the application works fine.I have done a lot of searching and rebuild-ed the project many times with changing the database. How can i get rid of this issue ?

A couple of possibilities:
In your setup project, on the properties window of the DB file in the File System on Target Machine view, make sure you didn't accidentally set the Readonly property to true.
If the database is in your Application folder in (for example) the Program Files folder, well that location is read-only to limited users. You haven't said whether your app is for all users or just administrators. If it's for a limited user then install the file to User's Personal folder or a location that limited users can write to. If the app requires admin privilege then your app needs an elevation manifest to cause it to run with admin privilege, if that's why the DB is readonly. Running your app as administrator would be a quick test to see if this is the issue.

Related

Sitecore Setup installation fails with error Failed to open XML file, system error:-2147024786

When running Sitecore Setup the following error pops up:
Failed to open XML file, system error:-2147024786
I've tried going through the eventviewer but to no avail.
Not unimportant is that I used the installer but forgot to change my rootdirectory. As a consequence I had to uninstall (using the same installer Sitecore).
Now however it "feels" as though there are some references or remnants left behind somewhere.
Who has a clue or can give me an idea of what is going on?
You are correct, this issue is because the previous Sitecore instance, with the same name, has not been removed completely. You will need to manually complete the following tasks to remove the remnants and be able to run the installer, it has worked for me in past;
Stop the App Pool for the uninstalled site in IIS
Stop the Web Application for the uninstalled site in IIS
Perform an iisreset in command line
Delete the App Pool and Web app in IIS
You should now be able to completely delete the folder containing the Website and Data folder completely
If you are still having trouble deleting it check the folder's Security Permissions, the Users and their Permissions and Read Only checkbox. Ensure you have control to delete
Delete the relating entry in the hosts file
If you also installed Databases access them via MSSQL Management Studio, take all relating databases Offline then delete them.
This will effectively remove all remanants of the previous site. If what ever reason the issue still persists, Sitecore's own Sitecore Instance Manager has a delete option which will completely uproot the site for you. Try installing with SIM then.

user.home in windows ts running eclipse rcp project

So me and a friend have created an application using Eclipse RCP. Now we want to distribute it using Windows Terminal Services. I have Windows TS up and running and have added about 6 accounts on it. I have also deployed my Eclipse RCP applications using the TS Remote App Manager. The application needs to create a folder in the users folder to store data, so the configuration is set up to create this folder "#user.home/...." Great, so now we try to access it from our TS Web Access site.
The first two accounts we have tried to run it on work fine, and are performing the way we desire. However, the remaining start the application but immediately give me an error message saying that we dont have access to the configuration folder at C:/Users/Administrator/... I can see the problem is that my users don't have the authority to write to the Admin folder, but I am confused as to why the user.home is referencing the Admin folder instead of the users folder. I have tried changing the users home folder in the profile and Terminal Services section of their properties but neither of these makes a difference. Does anyone know why user.home would return the Admin folder. Thanks!
Turns out the "Home" key was not set up in the users directory. It could be fixed by following the directions in the answer found here. Java user.home is being set to %userprofile% and not being resolved

What is the path to an installed ClickOnce application?

I wrote a "Hallo world" type Windows Forms application in C# to test authentication issues. I'm going to be running the eventual application from a server periodically, so I want to be sure I can get to the resources, and fix that before committing to the whole application.
So, in Visual Studio 2010, I choose Publish....
It says "Where?", and I specify a folder on a shared file system.
It says "How will your users install", and I say, "URL" or something like that.
It says "Where", and I give it a URL in the same shared file system, different folder.
All is right with the world....
Now, I install it on my server by double-clicking "setup" on the shared file system where I published the application.
Now, I find a shortcut in my start menu, all good.
Now, I want to set it up so SQL Server Agent executes it periodically (and tests authentication...) so, what is the URL I give it to execute? I've been trying everything, but not going so well. I don't understand the publish method much at all....
How can I fix this problem?
Look at the Start menu shortcut for your installed application and you'll see that it points to a "ClickOnce Application Reference" (.appref-ms) file buried deep within your user folder. You can start the application by executing that file.
Example:
Process.Start(#"C:\Users\Igby\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Microsoft\MyClickOnceApp.appref-ms");
I don't know anything about SQL Server Agent, but try giving it this path.

How to delete application file from AppData\Roaming folder

I am using windows installer to create setup project.
How I can remove/delete application files from AppData\Roaming folder when application uninstalled.
I tried added a special folder and set DefaultLocaltion to [AppDataFolder] but it didn't working.
Do I need to do anything else?
I'd need to understand what you are trying to do to give you specific advice. In general what you are trying to do would be OK removing files from CommonAppDataFolder but not AppDataFolder as trying to clanup user data from multiple user profiles is not a best practice. Additionally trying to cleanup Roaming Profile User data is outright impossible because the other users aren't logged on.
You'll want to read:
Managing Roaming User Data Deployment Guide
Assuming you are trying to do what I think you are, you'll need a cleanup script / exe that you leave behind on uninstall and a custom action to write to the registry during uninstall ( MSI can't do this natively ) to call that script/EXE. You'll want to leverage the Active Setup trick as described here:
Using Active Setup to Repair User Settings
The way it'll work is your uninstall leaves the EXE and registry entry behind so that when a user logs on it's roaming data gets pulled down from the server to local and Active Setup realizes it hasn't run the script yet. The script runs (once) and the data is deleted. When the user logs off the data is replicated / deleted on the server. Then they log on again it doesn't run again.
By default Windows Installer does not remove the files created by your application, after the installation. To do that you need to either write your own custom action, that will run upon uninstall, or depending on the tool used for authoring the MSI, you can use built-in options for cleaning the application locations, as some tools have this support.

Visual Studio and an Access Database - Operation must use an updateable query

I am deploying an .accdb file to the same directory as my windows forms program is being installed. However when attempting to update data in the database i get a "Operation must use an updateable query" error.
The file attributes are not read only, however when I open the accdb file it stats that the database has been opened read only. I must save a copy to make it not read only.
I do not believe this has anything to do with permissions, or file attributes. This is only on Vista, XP appears to work ok. The original accdb file is not read only when i open it.
What is visual studio doing to the accdb file to make it read only? and how can i fix it.
Are you installing into the Program Files heierarchy? If so that's read only for users and would cause the Access database to be read only. You should be installed any Access database file to the users Application Data folder.

Resources