I am working with a .net MVC4 web application. I use publish profiles to publish my application and all works nicely.
I transform the web.config, I set up a publish profile for each of the environments I am deploying to qa, production etc. The transform works perfectly when I build the package for particular environments.
Within my web application, I have number of other xml files that vary per environment. Is it possible to also transform these files for deployment? And if so, how might this be achieved?
I believe SlowCheetah was designed for this purpose.
Related
I am working on an asp.net solution and using my remote testing environment with godaddy.
The application is ready for deployment so i have two questions:
1- since the database will be different , i am thinking about using a different Web.config , but not sure how does it work and how to implement that so i can choose easily which web config depending on the poriject/solution
2- the solution i am working on could be personalized and deployed to multiple clients , so each client version will be different (Like the logo and other stuff not the design and functionality), do i need to create separate solution for each client or should i create a separate website project instead?
what's best practices in this case
Use configurations and associated config transforms. By default, your project gets a Debug and Release configuration, but you can add additional configurations. Then, for each configuration, you can have a separate Web.config transform, Web.Server1.config, Web.Server2.config, Web.Client1.config, Web.Client2.config, etc. When publishing, you choose which configuration you want to publish with, and that associated transform will be run against the Web.config file to change out connection strings, app settings, whatever.
For more information see: How to: Transform Web.config When Deploying a Web Application Project | MSDN
I'm trying to deploy one of the default template apps that VS2012 generates for MVC4 to a production server (not on Azure).
It turns out that I'm not smart enough to figure out how to get Web Deploy working. After spending an hour on diagnosing different 404s, 403s, and 401s, I am ready to either ditch Web Deploy altogether, or start my project using PHP instead.
Can I just copy and paste my files and put them somewhere?
I'm fine with manually updating the database schema.
Anything else that needs to be updated?
You can publish directly to "File System" via "Publish" menu in VS (choose folder on production server). Then create WebApp on IIS with this folder (on the server) choose ApplicationPool 4.0 open port for your application if needed and start it.
What in the world makes you even think you need to use web deploy? You do realize that the web publishing wizard has several options to choose from, including FTP, file system, etc... I don't see how you could miss these.
I have an asp.net mvc 4 application working with a simple dependency being resolved by autofac. The dependency in this case is an IEmailSender whose implementation I want to vary based on development vs test vs production builds. For example, the development(debug) build would send the email using one implementation, but production uses say amazon SES to send email.
What is the best practice way to vary the container dependencies in the global.asax file based on environment? I know I can use web.config transformation with web deploy and then read the web.config value to determine the environment and then "switch" the build configuration based on environment, but maybe there is a better way?
I would recommend the way you have described using the web config and environment transforms, as this is its primary purpose - to determine behaviour in different environments. You may also end up with more environments that just debug (test) and release (production).
The alternative could be to use conditional build statements like [Conditional("DEBUG")]. I would not recommend this approach however as you run out of build configurations pretty quickly if suddenly you have a new environment.
I have a question regarding Visual Studio 2010 publish feature which is used after you create a website (MVC framework) to push your dev changes to the live site.
I've never worked with MVC until a few weeks ago and
I've noticed that before pushing the website code I have to change everywhere where I have localhost in the code and replace it with the domain name I'm pushing to. Then if I want to debug anything on my local machine I have to revert everything back to localhost from domain name.
Q: Is there a way to not do this back and front url changing?
Basically I think it boils down to needing a software package or sth that knows to deploy the website with production configuration.
Maybe have a local branch and a live branch? This involves merging files all the time.
Thanks :)
I am not sure it works with MVC, but one approach we use for web services development is to use the web.config transformations.
This means that the normal development stuff is in Web.config and we have separate configurations depending on the deployment environment Web.staging.config and Web.production.config.
I've created a basic website using the Orchard CMS, and attempted to deploy it to my shared host, Softsys, using Web Matrix (via FTP). Currently, the site technically "works", however it looks like all styling has been removed (even from the dashboard).
Is there a step or files that I missed while deploying the site? I know "Web Deploy" is probably the preferred method of deploying, but I'm pretty new to this, and was not sure what the login specifics were, or how to obtain them for web deploy.
Here is a screenshot of what the site currently looks like deployed:
Edit: it turns out that the problem was on my host's side, for some reason the virtual directory was not being created properly - I still am curious what the proper/best practice method to deploying is however.
It looks like you have no theme applied. Check whether you have your theme existing in ~/Themes folder and properly enabled in the admin Dashboard. Maybe the /Themes folder content hasn't been copied?
UPDATE
If your hosting provider allows the option to deploy sites via WebDeploy - that would be the best one.
The easiest and most straightforward way to deploy Orchard site is to:
Have the ASP.NET application properly configured in IIS and accessible. If you use hosting - provider does that for you. If you'd have a dedicated server - you have to set up an application yourself.
Grab the deployment package from Codeplex, or build one from the sources.
Copy the whole package to your site's root (via FTP or WebDeploy).
Run it and proceed with the setup.
Basically - these are the same steps as for every "ordinary" ASP.NET application.
You probably need to set IIS user to have write access to some of the folders: Themes, Media and App_Data.