Moving ASP.net site to another server - asp.net

Assume I have asp.net websites on Server1 and need to move them to Server2, what is the best practice for this and how do I ensure that all relevant files, databases, etc are moved as well? Am I going to have to manually amend all the web.configs and other config files, plus find out what dependencies each site has, or is there a way to just export everything and import to the new server?
I have not found anything else on SO that has instructions for this.
Thanks
Edit: This is similar but not the same as the other question. The other question doesn't actually provide an answer, just some ideas about staging environments.
I'd like this to be as automated as possible due to having about 30 applications to move. The new server is pretty much identical but I noticed that when I moved one application using 'Web Deploy' as a test, it didn't bring over the dependencies and I had to manually find out which ones were missing and install them.

how do I ensure that all relevant files, databases, etc are moved as
well?
Typical asp.net sites have all data, and database under the one main directory. So you just copy/paste the full directory from the old to the new one server.
But we have some points to note here.
DataBase files are locked by the database, so you need to first remove them from the database.
In the new site you need to remount the database files and change the web.config according to the new server (eg, maybe new ip address, new names on database.
and finally the permissions on the new host must be correct and the same, if you have for example some directory that you need write permissions, you must add it also to the new server
You can also read: How to set correct file permissions for ASP.NET on IIS

Related

ASP.Net Accessing Server Filesystem

I am having trouble accessing information on the server my website it on. As the website was originally programmed with VB.Net, I cannot change the language without having to completely reboot the website. The way the website and server are configured, I can only use ASP.Net and VB.Net.
I am needing to add a section where they can create folders, edit folder names, and upload pictures and text documents on the server through the public website. I tried using parts of the FileIO, Server, and Http that should have worked, but none of them did. Most of my research is about local files and text documents.
I have not been able to find any information that works. Can someone help me? Thank you.
Firstly, creating a virtual directory in ISS mapped to somewhere on your disk would be a good start. This way you have a separate folder for user data in a folder with write access (make sure IIS has write access to the folder!), and the folder is not affected by website deployments.
Secondly, you might need to resolve absolute path for most of the System.IO.File calls. See How to convert a relative path to an absolute path in a Windows application?, just you will need to convert this code to VB.

WordPress hosted on Azure won't allow media file uploads due to bad temp folder

After recent upgrade to latest WordPress version, media uploads no longer work. They return missing temp folder error.
I found out that WP thinks that /wwwroot/wp-admin/ is the temp folder, that's where it is trying to send uploads.
I tried everything to force it to change within WordPress. Setting WP_TEMP_DIR, even tried rewriting core function that looks for temp folder in /wp-includes/text/Diff.php and setting static path.
Nothing works. I don't really know much about Azure, so it's been a pain in the butt.
My last resort is to install and use Azure Storage plugin for WP, but that's last resort.
Anyone can shed some light on this issue? Would greatly appreciate it.
UPDATE: Site is a Azure website, it does not use Azure instance.
http://www.windowsazure.com/en-us/home/features/web-sites/
I'm not to sure about Azure but you can change the tmp directory WordPress uses by using the command below. Make sure to make a folder in your home directory before doing so.
wp-config
define('WP_TEMP_DIR','/link-to-your-folder-you-just-made');
First of all, you should never store anything on an Azure instance, consider it volalite storage just like RAM - if the instance goes down or even gets randomly restarted you could literally get a brand new virtual machine with a new file system and lose everything.
That being said, you can safely RDP into the instance - create a directory (c:\temp for example) and as long as the IIS account has rights over the directory you won't have any issues using it as scratch storage. I would use Andy's approach above (I don't know wordpress, but I know Azure) and simply make sure that it points to a directory that you can use as temp and that the IIS user can safely use.
You may want to log in to the VM with RDP if only for the additional reason that it will give you great insight in how Azure structures the file system for the software it runs, you will see 3 drives and if memory serves one of them is purely a scratch drive that you can use. But it's not persistent, consider that it can get cleared at any moment.
Hope this helps,

Creating a MAMP Local Copy of a Drupal 6 Website

We're currently rebranding a client of ours and it's come the time to take the new brand to their website.
I've not much experience with Drupal other than the theming (I've themed a Drupal website in the past but not very familiar with the software's inner workings).
As this website is live, it's obviously not feasible for me to make any changes to the live environment, so I have downloaded the source files of the website to a local webserver (MAMP).
I also have a MySQL dump of the database.
I'm not sure what files need to be changed inside Drupal to allow access to the MAMP webserver. Could somebody point me in the right direction here?
How would I connect the database to the website, which files need modification?
I think the client is running Drupal 6.
Update:
I've installed the database and linked it up using the below line:
$db_url = 'mysql://root#localhost/databasename';
I've hidden databasename for anonymity.
As it's MAMP, the database has no password. When I load up the website I get an error that install.php is not found. It's not there because the website is already 'installed'.
I've also updated the $base_url to read:
$base_url = 'http://localhost:8888/foldername';
You only need to modify one file, 'sites/default/settings.php'; you'll just need to change the database connection string in there to match your new database settings. There may be a couple of other settings in there you need to tweak depending on the set up of the site (for example the $base_url or $cookie_domain).
Other than that everything in your installation should be relatively path-ed so there shouldn't be any need to make more changes.
i was facing same problem after couple of hours try i got solution : we have to check the DB (tick on list of databases in local host) [ observe this after DB list : Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server. so enable only the db you want to use] this will redirect to http://localhost:8888/foldername/install.php successfully :D :D

Configuring "Web application URL" for team use

So, I'm trying to take advantage of 'Path Variables' (or Linked Resources), in my teams FlashBuilder4 project properties, so that its not such a bear to get a new project out of SVN, and up and running. I'm all done with that, except that I can't figure out what I'm supposed to do for the "Web application URL" .
It doesn't allow me to create a "Path Variable" for http:// type items, only files and folders.
Short of saying that all developers need to configure their servers exactly thus, how can I configure this property so that individual team-members settings don't interfere with other team-members ?
What we do is create Linked Resources to point to a debug directory e.g. project/r11.1/dist in the main project. Everyone has r11.1/dist directory structure within their project. Each person has a local Apache server running, and each person sets up a local Alias in the server for r11.1 that points to whatever location the dist files are stored C:/.../r11.1/.
The SVN only contains the Apache Linked Resource name plus the common folder structure i.e. DISTRIBUTION/r11.1/dist along with the server name i.e. http://localhost.whatever.com/ + {DISTRIBUTION}/r11.1/dist
Does this make any sense in terms of what your after?
Here's what I did to solve the problem. I hate it, but it gets me to where I need to go.
I assigned the "Web Application URL" to the value "https://HOSTS.DASHBOARD.DEV/foo/bar/blah/..."
Then, each of the developers needed, in addition, to create an entry in their HOSTS file, to resolve 'HOSTS.DASHBOARD.DEV' to the proper ip address.
This works (so far), even though I'm less than satisfied with it.

Where should I put my log file for an asp.net application?

I have a ASP.NET application that we've written our own logging module for.
My question is, where is the standard place to write a log file to? I.e. the website will be running as the anonymous user identity (e.g. IUSR on IIS7) and I need a place where I know it'll have permission to write to.
Cheers,
App_Data folder on the root of the project. It isn't served to web requests; so other people can't snoop for it.
I would suggest putting the log file onto a seperate disk, though should give you a little performance gain so that your not trying to both read and write to the same disk as the website. If you cannot put the log file on a seperate disk, then I would simply choose a folder of your choice.
In any case, you will have to give the "Network Service" account "Modify" permissions to the desired folder.
If on the other hand, you have access to a databse, then log the information there. It will be much quicker than accessing the hard drive and won't be publically available. You'll also be able to report from the data quite easily.
I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that.
So for the moment I'm going with the CommonApplicationData Folder.
On Vista/Server 2008 this is C:\ProgramData\
On XP/Server 2003 this is C:\Documents and Settings\All Users\Application Data\
I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that.
If you have a website, you clearly have a folder somewhere. Can you not add a (non-web-facing) subfolder? It seems like that would be a more appropriate place to put your logs than dumping them into a global, shared folder.
You could also log to the Windows Event log or to a table in a database. How often are people looking at the event log? If it's being examined on a regualr basis, writing to a table amkes the reporting back much easier as it's trivial to reverse the order and only show the last X events for the current time period. The Windows Event log you can also query the Windows Event Log through PowerShell or with LogParser.
Push the app_data is the best idea, just bear in mind, when the publishing the projects, if the option "Delete all existing files before publishing" is ticked, then the current data in the folder will be gone. The workaround is to skip the deletion of app_data folder.
Another option to do logging is to use some existing framework such as Log4net.

Resources