I have been trying to find a neat tutorial, guide or step by step instructions for deploying an Asp.net MVC3 webapp but have found nothing so far. Everyone talks about his version of the stroy and different type of MVC versions.
Right now, I have build a simple Asp.net MVC web application which i need to deploy on my shared hosting account. In a very simple manner, I need to know which files should i copy. Do i upload everything in my webproject directory to the server including the controller directory, views, models, content and bin directory ?. What about the Global.asax, web.config, packages.config, myapp.publish.xml.
In short, I have no idea which files should be uploaded and which should be not. I am sure of one thing that i need few(MVC and Razor dlls) following dlls in bin directory. Just treat me as someone who has never deployed any website
NOTE:- I don't have VS SP1 installed and it doesn't install either. Basically i need a manual procedure.
Here is a tutorial on the MSDN site about how to deploy an MVC application. Typically, hosts will also now have WebDeploy available, which is a very easy way to deploy and update your application without having to worry about what files to copy.
Related
In my VS2015 environment I have a folder structure like this:
--/project
----/wwwroot
-------/js
-------index.html
----web.config
----project.json
...
...
When I publish my app to Azure, Azure puts everything under site/wwwroot. In this case I have two wwwroot folders, one under another. I don't mind this but my home page is not accessible. If I change the virtual applications/directories settings to point to site/wwwroot/wwwroot in Azure, I can see the home page but the application is not usable (WEB APIs, etc).
Any ideas on how to make this work?
You seem to have both web.config and Project.json.
So is this ASP.NET core or the legacy ASP.NET application? You will see another wwwroot in case of a ASP.NET core application.
See this article once on how to publish the web app: https://docs.asp.net/en/latest/tutorials/publish-to-azure-webapp-using-vs.html
I am developing a SPA application on ASP.NET 5 and I wanted to go one step further and separate the client (js, html, etc.) and the web api projects so that there is clear distinction between client and the server. Apparently there are number of technical issues that complicate things:
How can I include the js/html/etc. files in the resulting published project? (Ideally I want to be able to edit js/html and see the result in the browser on the fly). There is on way that I found to have a linked folder.
I want to share some of the javascript files even further e.g. angular services in Cordova js projects
There is very nice feature in mvc6 with environments that is not easily done in js project and I would have to still use some Index.cshtml to use it, but this is not critical though since I can use gulp to do similar stuff
How will the js know the URL of the api (this can probably be just done using gulp as well in some script with configuration)
I am not 100% sure this is a good idea at all, but maybe someone has tried it and can share experience and pros/cons of this approach. For now the most important problem seem to be of including the client project into the service project somehow so that they are joined into one web application that I can deploy in a way that does not make development harder.
I had built a website using Webmatrix 3 and used the '.sdf' database. However, I couldn't use the web deploy technique since my host doesn't allow it.
The files have an extension of '.cshtml'
I've uploaded the files using ftp and when I open the link to those pages, they only show the code like they show when they are opened manually by double clicking on them not even on a localhost.
Is there a way I can host my website with the .sdf database?
Sorry, the ASP.NET Web Pages framework (the pages you're talking about '.cshtml') needs your to have the Web Pages framework installed so that they can run.
IIS needs the Web Pages add on to work with the .cshtml files, and to render the HTML using the Razor syntax, that you're trying to tell me. I remember, once I opened the .cshtml page using Opera Web Server, and it gave me the same error since it was not able to render the HTML and thought the code itself was the HTML.
The problem about the .sdf is that you cannot use it. If they don't support Web Deploy, I think they don't support the SQL Server CE database either. This means that you cannot use them.
As, alread told, you can only ask your hosting service provider for help in this scenario. They can guide you further. Or can forward you to some other branch where these services are supported.
I've followed the steps to bin deploy my MVC3 application into IIS7, but when I browse it after deployment, it is showing me a list of file similar to ftp website instead running the pages.
The dlls that are explicitly added in the bin folder of my application are:
Microsoft.Web.Infrastructure
System.Web.Abstractions
System.Web.Helpers
System.Web.Mvc
System.Web.Razor
System.Web.Routing
System.Web.WebPages.Deployment
System.Web.WebPages
System.Web.WebPages.Razor
I set security to everyone full control to test, so its not a security issue for sure
and when I try to navigate to home/index for example, IIS wont recognize the path, see error below:
.net 4 is installed, application pool of the website is .net 4 also
not able to find solutions
What I am missing to do, any suggestions ?
Thanks
In order for IIS (this only applies to IIS 7+) to process MVC request, the easiest option is to set your Application Pool pipeline to Integrated instead of Classic. Without giving an MSDN level reason as to why this is, essentially classic mode wants every request to have a file extension. If the request does not have a file extension, IIS will go look for that directory. Integrated mode allows the request to go into the ASP.NET pipeline, which will then trigger your routing in your MVC site and the dynamic content will appear.
I'm using Publish/Web Deploy to deploy an asp.net aplication from Visual studio 2010. It works perfect, but there is a problem. If the new release is not working as expected, the old version is already replaced by the new one and there is no easy way to roll back to the working version. How is this best solved? I wish it was possible to keep the old version on the server so I could just switch back if needed.
With WebDeploy there is no built in rollback feature, so once you've deployed that's it.
There's a number of hand rolled strategies you could put in place, for example:
Limited Access e.g. Shared Hosting:
Where you don't have full access to the machine -
Backup the live site beforehand by downloading it.
Keep copies of what you deployed so you can push the previous version should something break
Full Access:
Maintain two sets of folders for the application and map your site to one or other of these folders. When you come to deploy switch the IIS site's physical path to the other folder then deploy. If the site fails then just knock the site back to the original folder. Each successful deploy would alternate between these two folders.
For stuff like user uploaded content you'd need to map virtual directories to a place on the file system that's always the same place because you don't want to be copying these around each time.
You're not the only one who has encountered these issues. Have a look at this article by Rob Conery and his observations about the state of affairs regarding ASP.NET deployment.
ASP.NET Deployment Needs To Be Fixed
Getting Constructive On ASP.NET Deployment
Using some form of Source Control would be another alternative. We use subversion, so if the publish goes bad, we can just update back to the last-good revision, and publish that. Even if you're the only developer, using source control can be very useful.