What is needed to open up an MVC project on a remote server? - asp.net-mvc

I'm new to web development so please be kind. Anyway, I'm writing a web page in visual web developer 2012 and have hit a roadblock. I've got lots more experience with writing console applications. When writing one of those and you build the application, the bin folder is populated with the files that are required to run the application, most notable the .exe . But when I build the page all I get is .cshtml files, which when opened all it does is open the code in my web browser. I tried to get an answer on another web site but all that i got was "open it up on a web server". That doesn't make any sense to me. Please help.....

You open the project locally on your workstation, as you would any other project. But when you're ready to publish the project you would send it to a web server.
Visual Web Developer (being akin to Visual Studio, no?) should have a small built-in web server of some sort which it uses when you execute your project in debug mode. (There are more details than that, but that statement alone should be true enough to get you debugging.) That's fine for ongoing development work, but not for the resulting production application.
Analogous to installing a console application on a target workstation, you would need to publish your web application to a web server. This server may coincidentally by the same workstation on which you develop the code, but that's not a requirement.
A "web server" in this case can be one of many things. Your computer (running IIS, most likely), a server hosted somewhere, a service in the cloud, etc. And "publishing" could mean any number of things as well. Uploading the files, using built-in publishing tools in the IDE, even just committing the files to source control and allowing an automated publish service to fetch them (I do this a lot in Azure web sites).
Ultimately, the way you execute a web application that's been published isn't by double-clicking on a file anywhere. The .cshtml files, as well as any other needed files (binaries, config files, images, style sheets, etc.) are stored on a web server somewhere and you would "run" the application by making a request to that web server, which takes the form of browsing to a URL in your web browser.

Related

How do you publish an ASP.net MVC application from Visual Studio 2013 to your local network?

I made a simple ASP.net MVC web application in Visual Studio 2013, and I want to deploy it so it can be accessed from the browser on other computers on my local network. I have tried right-clicking my project > Publish (not sure what settings to use, Web Deploy, Web deploy package, File system,
I published the website to my inetpub/wwwroot folder.
I managed to get IIS up an running, I've tried adding an application in the manager and editing the permissions to Everyone. I tried navigating to localhost/application_name but I was getting errors about not being configured to list the directory. I enabled directory browsing, but that just means it now shows a list of the files. How do I get it to actually run the app when I navigate to it in the browser?
Am I close?
Edit: currently trying this http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-computer (although this I think is a step or two ahead of where I am)
Also tried this: http://www.programmerfish.com/how-to-deploy-asp-net-web-application-on-the-network-in-windows-7/#.VGTLCvnF81L no luck so far
You can use IIS Express which comes with visual studio 2013. I've used this method to allow other members of the staff to access the website that is in my computer. Scott Hanselman has done a great post which I use every time when I want to expose a website hosted in local iis express to others in the same network.
http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
If you have any queries, let me know. Hope this helps
When I want to use IIS Express within Visual Studio for development, but allow local network users to see a version of my site, I tend to create a publish profile in VS that publishes to the local file system (e.g. C:\Publish\<yourwebsite>). Then from IIS Manager create a new website pointed to that same folder and it should be accessible to you via http://localhost and to network users via http://<your-pc-name> or http://<your-local-ip>.
You will need to add an exception to Windows Firewall to permit HTTP requests (i.e. port 80) through to your local machine, but if you have configured IIS correctly they should see the website.
It is possible to make IIS Express available to remote clients but that's not what it's designed for so really you're better off going down the IIS route since this will allow you to test the configuration as it would be on a live/production setting at the same time.
Check this, and old version of the same question. I'd bet you need to install IIS locally
Use Visual Studio web server in local network
You need to enable IIS on the host as IIS Express is not built with that in mind. Its for debugging purposes.
You've also not mentioned your binding configurations or your app pool settings.
Here is a comprehensive tutorial on how to publish your application using IIS IIS Video tutorial
You will need to ensure the binding that you specify is available across the network and that the connecting clients have permissions.
The issue was that ASP.net was not registered with IIS
Opened command prompt as administrator
Navigated to C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Ran aspnet_regiis -iru
Now web app runs in IIS http://www.asp.net/web-forms/overview/deployment/configuring-server-environments-for-web-deployment/configuring-a-web-server-for-web-deploy-publishing-%28remote-agent%29

How do you deploy a MVC4 .net app to production WITHOUT Web Deploy

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.

Azure cloud service publishing - where does it go?

I created an asp.net mvc project in VS. I created an azure cloud service. Within the VS solution I added an azure project to enable me to publish to my cloud service. The cloud service has a web role and it’s published to a production environment. When I publish the project, I have my domain .cloudapp.net and I can then view my published project from a browser.
Job done. All good so far.
What I’m unclear on (and this is partly because my azure and asp.net mvc knowledge is limited) is where the project files actually reside (and the file/folder structure) and how to access them? I know they are on an IIS server somewhere but that’s about it.
With ‘traditional’ websites you have a webserver, a wwwroot folder and you stick your web pages etc into them and can see/access them through ftp etc.
Apart from wanting to know the answer to the above question I actually want to farm out the web ui (view) part to a web developer whilst I concentrate on the back end stuff. He doesn’t have visual studio so I’m unclear on how to best approach this?
I’ve noticed on the windows azure publish summary within my solution that you can enable remote desktop and enable web deploy which I suspect may be of help to me but as the solution is all working fine at the moment and I’m demoing it to a client tomorrow I’m a bit reluctant to make any last minute changes..as I’m sure we’ve all suffered the consequences of that before.
What I’m unclear on is where the project files actually reside
(and the file/folder structure) and how to access them?
As you have mentioned, these files reside on the server itself. If you connect to your server via Remote Desktop, you can see the files under D:\sitesroot folder (actual name of the folder can be found by launching IIS Manager on that server).
Having said that, it is not recommended to make changes to the files directly on the server. This is because if your server goes bad for any reason, Microsoft will provision a new server for you and it takes the code from the package file when you last deployed your application. This the changes you have made on that server will be lost.
Regarding your other question about having somebody focus on front-end development, I'm pretty sure you don't want him to working on production server directly. I'm assuming you have a centralized code repository somewhere where everybody checks in their code and then you build stuff and then deploy it.

How to go about deployment of ASP.Net 4.5 / MVC 4 /SQL Express 2008 R2 to a Windows Azure Free Website

I am very new to Windows Azure - have been into asp.net for about 10 years now and have been deploying applications via Database backup and restore on production and copy of final code bits from source control to the root folder on production database.
I am doing my initial reading and finding it a bit difficult to absorb the overall process of deploying an ASP.Net MVC web Application to Azure.
I have managed to have the database and the website code on Azure and it is up and running, but I can't get to terms on the following points and want to understand them better to have a regular deployment on place as versions of my app keep going up.
Database doesn't work like backup a local database and then upload .bak file and restore to the production server.
Nor can I see my website files.
Update: 04-Aug-2013
Azure Websites have an FTP option. You can see your FTP host name in respective website Dashboard. The username and password for FTP are located in the publish settings file (note: you got to pick up the FTP username and password, NOT the publish username/password. They both are different.
When I am getting ready for version 2.0 of my product, how do I get the database from the Azure SQL, upgrade it to 2.0 and put it back?
I assume the publishing wizard from Visual Studio should be able to take care of code upgrade, but how do I edit my production web.config file on the fly?
How do I take my website offline and show users my custom "offline" page when I am in the middle of the upgrade? (Stopping the website shows up the Windows Azure site not available page).
For your database backup / upgrade questions
For migration of databases to SQL Azure (or pulling them down) the SQL Database Migration Wizard has proven to be a lifesaver for me, get it here:
http://sqlazuremw.codeplex.com/
This will pull and push both data and schema for your database.
For seeing your website files
You won't be able to if you are using Windows Azure Websites.
For editing web.config on fly
You can't. BUT -- you can edit connection strings and appsettings through the 'configure' tab of your website like so:
Turning your website offline during upgrade
While you cannot specifically use the app_offline route without another deployment. One thing you could do is change your default document. This is easily done right in the same 'configure' tab for the website in the portal as I mentioned above, see here:
Hope this helps.

How to publish an ASP.NET MVC website

I've a site that I'd like to publish to a co-located live server. I'm finding this simple task quite hard.
My problems begin with the Web Deploy tool (1.1) giving me a 401 Unauthorized as the adminstrator because port :8172 comes up in the errors and this port is blocked - but the documentation says "The default ListenURL is http://+:80/MsDeployAgentService"!
I'm loathe to open another port and I've little patience these days so I thought bu66er it, I'll create a Web Deploy package and import it into IIS on the server over RDP.
I notice first that Visual Studio doesn't use a dialog box to gather settings, or use my Publish profiles but seems to use a tab in the project properties, although I think these are ignored when importing the package anyway?
I'm now sitting in the import wizard with Application Path and Connection String. I've cleared the conn string as I think this is for some ASP stuff I don't use but when I enter nothing in the Application Path, the wizard barks at me saying that basically I'm a weirdo because most people publish to folders beneath the root site.
Now, I want my site to be site.com/Home/About and not site.com/subfolder/Home/About and I think being an MVC routed site that a subfolder will introduce other headaches. Should I go ahead and use the root?
Finally, I also want to publish a web service to www.site.com/services/soap which I think IIS can handle.
While typing this question, Amazon have delivered my IIS 7 Resource Kit, and I've been scouring the internet but actually I'm getting more confused.
Comment here seems to show consensus opinion that Publish isn't for production sites and that real men roll their own.
ASP.NET website 'Publish' vs Web Deployment Project
...I guess this was pre- Web Deployment Tool era?
I'm going to experiment on a spare box for now but any assistance is welcome.
Luke
UPDATE
The site was imported (to the root) manually with Web Deploy and it worked. If you get the error "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' " its because your app pool is 4.0 and should be 2.0.
If you are using VS 2010, may I recommend Scott Hanselman's Web Debloyment Made Awesome?
http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx
Even if you are using VS2008, there are nice concepts there that will probably help.
I've experienced the same frustration and trouble with this as well. Coming from a Java web background where we can package everything as a single WAR and toss it on the server, the deployment process with ASP.NET seems archaic.
I currently have a python script that uses FTP to transfer the needed files to my test instance on the remote server. I have another python script that transfers those files to my live site. These scripts are smart enough to take care of differences between some of the configuration files etc..
I've found it much easier than trying to setup permissions or using the Microsoft deploy tools.
Hi you can use filezilla software to upload

Resources