I have recently inherited an ASP.NET website to look after.
I have a copy of all the files but coming from a PHP background I am not sure how to make changes and deploy it.
After I make changes to the site I presume I need to compile it. But can I then simply copy the site onto the server or do I need to create a setup package and 'install' it over the top of the production system?
Also, where does the code-behind DLL 'sit' in the file system?
Is there a decent guide to this kind of stuff?
After making changes and testing them with your local copy (I'm assuming you know how to do that), click the "Copy Web Site" button at the top of the solution explorer. This lets you connect to a remote server (your production box, presumably) and will compare your local version of the web site to the one on the server, and flag any files that have been changed locally. You can then update the server version so that it matches your local version.
If you're deploying the web app as a compiled DLL (instead of as uncompiled CS files), the DLL should sit in the application's \bin folder. Even with a compiled DLL, you still need to deploy the ASPX files.
You don't have to go for a setup. The answers to your questions differ based on whether you are using a 'WebSite' or a 'Web Application Project'. Please answer to following and we can follow up after that;
Which version of .Net / ASP.Net you use? (1.1, 2.0 or newer)
When you open up the package in VS (Visual Studio) and right click on the top most group (solution explorer) do you see options like Build web Site, Publish Web Site?
As a long-shot just try to create an IIS web site pointed to the root of your files and see if anything comes up. If this works the work process will be;
1. Do a change
2. Compile
3. Hit the web site URL and see whether it reflects
Related
I am a new-ish solo developer in a company, and I am trying to deploy an existing ASP.NET website to Dev and Prod environments. I think this is a WebForms project (I am not sure how to figure out what kind of project this is tbh).
When I Publish the website to a folder using Visual Studio, everything but the Content, Styles, Scripts, Images, Resources folders get published properly. As a result, after deploying on IIS, the website loads with just HTML, no styles, themes or images. I have to manually copy those folders over from the code repo to the Publish folder after publishing is done.
How can I fix this?
Tools: ASP.NET, Web Forms (I think?), Visual Studio 2013
This suggests that you are working and attempting to maintain this web site as a web site applcation.
Keep in mind that a Web site?
This has all of the folders and includes your css files etc. This folder is ASSUMED to be a 100% valid working copy of the web site. Often developers will open the web site "live" on the hosted server directly. This is not a great idea, but it is VERY easy, since you can say open up a web page, modify it, and save, and you are DONE!!!
In effect, no real publish is required. You have a full working web site that the web server (IIS) is running against.
if you want to work on a copy, then you can/would copy the whole web site from the wwwroot or whatever folder the IIS web site is CURRETLY consuming and using.
You can then ALWAYS open the web site using file->open web site. You NEVER and DO NOT in ANY case want to open that web site as a web site project or so called applcation. (that would be the prj, or sln file).
However, it is possible that you have a asp.net web site applcation. (the key concept/word here is "applcation".
For a application, then yes, you REALLY need to use web site publish. That publish will compile all the code, remove the c# (or vb.net) code, compile those to .dll's. That resulting folder publish will thus have MANY parts removed, including source code, and the code will have been pre-compiled by Visual studio as opposed to letting the web site (IIS) do the compile of such code.
And with this choice, you of course have to mark/check/set/ensure/control/be aware/know/ that any additional folder has to be marked as part of the project. In fact VS should show such folders as "grayed" out, and not to be part of the publish process.
Say, I have a folder with a bunch of css and other files. So, right click on that folder and check the settings.
let's say do this from VS for a folder I have called content. (lots of css and other things in that folder in my case). And this is a "applicaiton"
So, right click, and check this:
NOTE very close in above - "Exclude" from project.
also, you can right click on ANY file in that folder, and display property sheet, and you have these options (which publish will use).
So, i right clicked on the file called Burke.css, and we then get this:
So, check those options for those missing files. And check the options for the folder(s) (include/exclude from project).
My spider sense suggests that this was a web site, and you trying to work/change/develop/use this web site as a web site project.
You can certainly covert over time to a "application", and while I prefer a "applcation" over a web site, often many prefer a web site, since it does not really require you to use the publish options at all.
You can super easy find out - just look at the web site running on IIS - does it include the vb.net (or c#) files on that site? If thsoe code behind files exist, then you have a web site, and not a web site applcation.
To learn more about .Net I created a website but now I want to learn how to Host it, in PHP I would just upload the files to the host and check everything how do I do this with a .Net website?
I have 2 Databases, Controllers, and Views.
I done some research and people said to just upload the files from the bin folder which I tried but it did not work, also tried just tried uploading the DLL files with no success.
Also tried uploading all the files from the project folder but it did not work.
Found a tutorial which right click the project and publish it so I tried publishing it to a folder and then uploading that but that did not work to.
To successfully publish and run your website on your host machine, the host machine must first have IIS (Microsoft's Internet Information Server) installed and running.
Once you have that in place there are several different approaches to deploy your website to the host. Here is a link to guidance from Microsoft's asp.net site in regards to "Choosing the Right Approach to Web Deployment".
Specifically, for you to be able to go "right click -> Publish" from within Visual Studio the relevant approach is "Web Deploy Handler (Publishing)" and you can find detailed instructions for setting it up in "Configuring a Web Server for Web Deploy Publishing (Web Deploy Handler)".
You just upload the files.
But you msut be sure that IIS is configured th acctually watch for a .NET app in the folder it loads in.
For normal we apps you did the right:
Also tried uploading all the files from the project folder but it did not work.
If it "just does not work" then it means .NET is just not there on that server or the folder you upload to is not configured to load a .NET project. Period. This is a fallback (technically you can upload less - the project file, i.e., is not needed), but it should work.
I'm working on a Visual Studio 2012 web application, and need to allow colleagues to view the current website by my IP address (while I would access it my localhost). It appears that hosting the site locally through IIS7 and allowing others to access it by my local IP the simplest method. After troubleshooting and experimenting for a day though, I still don't understand the relationship between an IIS7 site/website/application and Visual Studio web application, and the MSDN explanations are really hard to follow.
Basically, I'm trying to understand:
1) How to set up a IIS website and application (should the 'physical path' be the VS solution folder or deployment package .zip folder?, for example)
2) How to most simply deploy the web application (e.g. File System/ Web Deploy/ Web Package, etc.) and
3) The order to do all of this.
I'm running VS as administrator, my port 80 is open, and have IIS7 set to use .NET v4, yet when I publish the selection using File System in VS2012 to my C drive, the resulting site gets a HTTP:500 error, with no source code underneath. (Also, before even publishing, setting the solution to use my Local IIS instead of IIS Express and previewing results in a blank page). If there is a better way to do this please let me know.
Thanks in advance.
If you don't want to learn (or bother) with the details of setting it up, you can use a small utility like 'ngrok' that will allow others to view your website at 'localhost'.
Takes about 5 minutes to learn and get up and running (and its free).
https://ngrok.com/
I hate to sound stupid, but ASP.NET is not my forte.
I have build an ASP.NET application which I now which to deploy to a production server. Searching on the web I found that it's recommended to just use the Setup tool within VS2010 to compile and install the files on the production servers. However, I find it a bit weird:
The files on the server are exactly those that I had on my system. I would've imagined that moving to a production server would involve some compiling and compression of file content so as to improve execution. But in practice all files on the server are exactly as they are on my local system -- I can even modify my .cs file on the servers and that works!! (Surprised ;-)).
Following from the above, all my code is readily available on the server for anyone to see. I am not sure if this is a problem... For example, could it end up a security risk (due to passwords within the files)?
Did you create a web site or a web application project in VS2010? If it's a web site, you'll want to convert it to a web application project. Web sites can be compiled on the fly, when the app is first requested. A web application project is pre-compiled, and none of the .cs files will be pushed out to your production server when you publish the project.
I know I can do the conversion by right clicking on my web projects and selecting "Convert to web application", but that menu item might be present because of ReSharper (5.1) or the PowerCommands for Visual Studio 2010 extension from Microsoft.
Also, check your .aspx files. Do you have a .aspx and a .aspx.cs only? Or is there also a .aspx.designer.cs file? The designer files will only be present for a web application project. If you don't see them, you have a web site, not a web application project.
You can do as you've done but I would not recommend it for the reasons you've mentioned. Plus your code is not actually compiled!.
The typical approach would be to compile the app, then take the /bin dll and push them up to the server. A basic site needs a web.config, a bin folder with your DLLs and any ASPX files which contain the markup, any static content like JS/CSS/Images etc.. In this instance the markup (aspx) can still be edited but the CS code is inside the DLL and no CS files are on the server.
You can also pre-compile the whole thing which will actually modify the ASPX files and you can find out more here: http://msdn.microsoft.com/en-us/library/ms227972.aspx
Visual Studio 2010 has a "Publish" feature under the Build menu which can push the site for you via FTP or Web Deploy but this is only useful for smaller projects.
For most things you will want to look into msbuild or nant to script the process and this can allow you to incorporate things like JSmin or JSLint into the build/deployment aswell.
Hope that helps.
-fs
It depends on how you do publishing. http://weblogs.asp.net/owscott/archive/2009/06/06/visual-studio-2010-1-click-publishing.aspx. "Exactly the same" is not a problem. Your expectation on compiling and compression is "so abnormal". Why must they be executed to make you feel happy while what you just need is a simply deployment?
How to protect your code is obviously some extra work you should manually do, such as tuning NTFS permissions and so on. There is nothing so automatic.
I've spent a great long while googling this problem without any luck and I've always found great answers here, so here it goes:
[BACKGROUND]
I have a web application which was developed in C# with Visual Studio 2008. It was a part of a solution with another project which contained a web service. This was not created "IN" IIS (I was using the Cassini ASP.NET Development Server at first, but have encountered numerous issues). I finally got approval to install IIS 5.1 (Government Network - using Windows XP) so I wanted to host my apps there for development.
I moved my projects to another folder created my IIS virtual directories, pointed them at the right location, updated my security settings, ensured that .NET 2.0 was selected and tested the site and web service. They function perfectly in IIS.
[ACTUAL PROBLEM]
I open Visual Studio, click File > Open > Web Site > Local IIS > [Application Name] and it opens up, but my .design files aren't nested under the ASPX / ASCX objects, and when I right click on it and select "View Code" it takes me to the markup instead of the code behind. Once I reach the code behind, I don't have access to any of the members of the design, as though there was a problem with the wire up.
I have tried creating a web site from IIS through Visual Studio, and it works perfectly. I closed it and opened it up again to see if that functionality would persist and it did.
I've encountered this before and have had to re-create a new site through Visual Studio, and manually re-populate it with all of my classes from a "broken" solution. I would love to solve this the correct way.
Please help!
Adam
The best thing I could suggest would be to go through the Project files with a fine toothcomb (as Filburt suggested) and make sure the references are pointing to a virutal directory (or via the inetpub folder, if thats how your IIS settings are configured), rather than a file system directory.
You might also want to check your IIS settings. Is your virutal directory set up to point to a file directory?
Good luck!
All dependencies between markup, .design and code-behind files are laid out in the project file.
You could use a sample project to discover how to correct your existing project.