Turning a precompiled web app to a 'normal' web app - asp.net

I've got a quick question about precompiled web apps:
I've recently took over a project done by someone else, which is a precompiled web app. This means that it has no App_Code folder, of course. Due to the nature of this project I would like to put my code on the server anyhow.
I can't just add the code, because I'll get an Exception stating that the App_Code folder isn't allowed because it's a precompiled web app. If I remove the file 'PrecompiledApp.config", then my application crashes.
So what are the correct steps in turning a precompiled web app to a compile-on-demand webapp?
Thanks for the help.

I can get this working in VS2010.
Go to your web app settings and select the Package / Publish Web tab. There's a drop down that's probably defaulted to 'Only files needed to run this application'. If I use this it just publishes the compiled DLLs to the server and the web files, but none of the code.
If I change this to 'All files in the project folder' then I get everything - all the C# code for my controllers, for example.
Of course whether you would want your production code on a server is a different question, and you also get all the VS solution files and stuff like that too so it looks quite messy.

Related

How do I properly deploy a website from Visual Studio and make this ASP based site function properly?

I'm sure there's something simple I'm missing.
I'm attempting to help a buddy move his ASP site from one host to another to avoid some questionable billing practices. I usually work with PHP-based sites (Wordpress etc.) and, unfortunately, have no experience with VS or ASP.
He's temporarily moving to Godaddy on their Plesk offering temporarily until he can work out something else. He provided me with all of the files contained within his ftp (containing his site's default.asp file, header, footer etc.) as well as an archive.xml, parameters.xml, and a systemsinfo.xml file. No .snl file or anything like that.
The files did not come with a web.config file. The error I keep getting, after uploading the FTP files is "HTTP Error 502.5 - Process Failure". From my understanding, it's often related to the web.config file. And from what I understand, you can have one generated by deploying the site through VS. Problem is, I'm at a loss as to what the proper actions to deploy this project.
Plesk provides a .publish settings file, I'm just at a loss as to how to properly open this file in VS to then have it create a "web.config" file and proceed to have it publish to the hosting. Part of this is I'm unsure how to properly open a project like this in Visual Composer to then proceed with the process of setting a web.config file and going forward with the deploying.
Not knowing exactly how to open this project without an .snl file or anything, I tried creating a new project and dropping in the other files to try and set up the process that way with no luck. Considering that Plesk provides a deploy file with that information, I'm assuming if I can properly open the project, working locally, I can then go through the deploy process. I'm just at a loss as to how I can properly setup a new project with someone else project files without an .snl file or otherwise.
Any guidance that you provide would be awesome.
Thank you.
Well, if you missing basic files required to operate the site such as web.config, then you don't have the site or files required, right?
Either FTP down the existing site, or you go to the source code and VS project, and re-compile the code, and re-publish. In fact, I suggest publishing to a local simple file folder.
Even publishing to a local file folder is a good start. Now, just copy that local folder that you published from the source code project, and that published folder should work on the new site. But, really, missing files like web.config? Rather fundamental that you have ALL files of that existing published site, or you have to go back to source code project in VS and re-publish.
since that site has vb.net or c# code? Then it also not clear if the original site was a
asp.net web site
or
asp.net web site application.
Rather critical you determine the above. The reason is that for a asp.net web site application, then at publish time, all code is complied at publish time, source code is stripped out, and then you have a working site.
If this is a web site (not web site application), then all source code is in fact published to the web site, and IIS is now responsible for compiling the .net code.
but, gooly, without a web config file, you simple don't have the files for that site to work - NOT even close!!!
but, as noted, if you have the original source code and VS project, then I would of course use the source code project for the publish. As noted, you can publish via FTP, and several other ways - but I in most cases use folder/file publish to a local folder, and then that is FTP up to the site.
You also don't mention if a database is involved. But, the connection strings to the database will FOR SURE change on the new site - and that boatload of required information will of course be in the web config file.
So, what road will much depend on if you going to download the exiting site, or your going back to the original source code and Visual Studio project.
So, first step - which will take about 10 seconds of your time is to determine if this is a asp.net web site, or a asp.net web site application.
If the existing published site has the c# (or vb.net) source code, then this was/is a web site.
If the existing published site does NOT have the source code, then of course this was a asp.net web site application - and Visual Studio is responsible for compiling the code BEFORE publish.
I guess this really comes down to if you have the source code and the original project used to build the site in VS or not?
I mean, if you have the source code (not compiled) of that site and have the full project in VS, then that's your best starting point. And if that site was published asp.net web site (application), then FTP and downloading the site WILL NOT get you a working asp.net project in VS.
This is much like saying you have a some .exe program, but don't have the source code and project used to build that .exe.
Same goes for asp.net. but, as I stated, often the web site as opposed to web site application model is used, and in that case, then you would get and have the source code files by a simple FTP download. But, you don't even have the web.config file - and that makes no sense at all, since that going to exist in the current site if you download, and it would exist in the original VS project used to create that site in the first place. During a publish, we often have an additional config file that has the local database connections, and during publish, they are transformed into the correct database connections for the published site. But then again, you not even noted or mentioned if a database is involved here.
I mean, if I was handed a LAMP project (Linux, Apache, MySQL, PHP), and had to publish that site? gooly, I not worked with LAMP, but I'm sure it would be a week, or more for me to figure that out, since I'm not familiar with LAMP, and how such sites are laid out, let alone how the configuration of such a site works. Big job if the whole system, programming language and framework is something you never used before.
I know that Godaddy use Plesk control panel too. But you need to make sure that Godaddy has support .NET Core. You may refer to this post https://dotnetblog.asphostportal.com/how-to-fix-error-502-5-process-failure-asp-net-core/. I believe it will solve your issue.

Publishing my asp.net mvc web application using Visual Studio Web Deploy will list some files as need to be deployed , although i did not modify them

I am working on an asp.net mvc-5 web application , and i am using Visual Studio 2013 , to publish my web application to an online hosting using web deploy.
now i published my web application correctly. and i check it online and every thing is working well.. then today i modify a view named "Contact.cshtml" and a file named "style.css", and then I try to publish again. i was expecting that only the two files will be shown in the preview window since they differ from the publish files. but i was surprised that my project.dll is being listed although i did not chnage it (i did not modify any cs file) and the modified date for this .dll is that same modified date which is online..so can anyone adivce on this ?
here is how the preview window inside VS 2013 looks like:-
So can anyone advice why my project.dll file is listed although i did not modify it since i did my last web deployment ?
Either you ran the project before publishing and/or your are building your views in the solution.
It may be that your style.css and Contact.cshtml files have the wrong Build Action. The proper build action for these files should be "Do not copy", which seems counter-intuitive since the Web Deploy will copy it anyway. You can change the Build Action by selecting each file in the solution explorer and setting the appropriate value.

Old Asp.Net Web Site Project - No Project file?

So I have an Asp.Net website that i'm responsible for. I'm having a build issue, that as far as I can tell, may be either MacAfee or some other random cause.
But thinking back, I want to say the problem started when I added a "Test.aspx" form to the site, did some testing, then removed the Test.aspx form from the site.
I'm using TFS 2010 as my source control as well. Which I don't know if it applies or not.
My question is, is there some hidden location where all files to be included in publishing a website is maintained?
Is there a Project file for a Web Site app and if so where is it?
I've built the site using MSBUILD and notice some metaprj project file in the output but I can't seem to find any such file.
Web Site apps aren't meant to be built into a dll file. There is a conversion wizard to make it a web project but it doesn't always work well. My advice would be to continue to work with it as a Web Site app. The code files are compiled at at runtime on first use. You can run from Visual Studio or setup a site in IIS. Nothing is hidden in a Web Site app and there is no project file. So, you shouldn't have a build issue because you shouldn't be building. Try to run the app as is and if you get an error let us know what the specific message is.

Deploying a Visual Studio website vs web application

So I'm using visual studio 2010 to build a website that was formerly running on PHP, so I'm pretty new to the environment.
In starting the project I built a website project, not a web application project. I know that will probably generate a lot of "never use a website project, use a web application project instead" comments, but bear with me.
I'm attempting to provide our server team with the necessary files to compile on our server for the first time. However they're used to working with web application files, not website files.
Normally they are given the source code and a batch file that compiles the code into deployment directories and then they just move the files to the server from there. I'm pretty sure that the other teams use deployment packages to do this, which obviously isn't an option for a website.
My question is, what would be the equivalent steps for getting the source for a website ready to deploy vs a web application? I have published the website to a separate folder and this has rendered what I think is the equivalent in many ways, but I wanted to make sure.
Also, is it possible to publish certain parts of a website without others?
Please with-hold all the comments about how I should be using a web application instead, google seems to assume that's all that's used out there too.
Thanks!
There isn't much to deploying a web site other than copying the source files to a directory in IIS. It will compile the site automatically on the first page request.
I agree with Britton. I personally prefer web application but with the web site project you have 2 options.
Either a) Upload all the files (including the .vb or .cs files) and the web server will compile on the fly. OR, you can publish to a separate folder locally on your machine, and then upload that folder. I would do the publish if you don't want anyone seeing your source code.

Old VS2008 ASP.NET web site project doesn't update DLL in bin after building

I have inherited an old ASP.NET web site project (not a web project), so it uses the web site model from what I gather. There is no code in the App_Code folder. There are dozens of aspx and aspx.cs files in a different folder.
What I have done so far:
I have copied the entire project locally from the previous person's fileshare (he's gone and didn't use TFS).
I loaded the web site in VS2008, made a small change to an email address in the code and rebuilt it.
At this point, it compiles fine, no errors. But the dlls in the bin folder do not reflect the proper date/time stamp. I published the site to the test server and it is still using the previous email address before I updated it.
My problem: Why would the dll not get updated? I have read there is a difference between a web site model and a web application model. When I select Build from the menu, it actually says "Build Web Site", and not the project name. This is my first experience using this type of project.
My Question: Any ideas what I can do to resolve? I have already combed through similar questions on this site but the ones that are closest to my issue don't have resolve/answered status.
Thanks
From what I recall, didn't websites perform runtime compilation and hence not generate a dll? Don't quote me on that though, it's been a while. Could you convert it to a web application from VS?
You should have a solution with at least two projects:
Sln
- Website
- DLL
On the Website add a reference to the DLL and build. Should take care of it.
Alternatively you could convert to a Web Application as well, but you'd have the same problem if your project structure is not correct.

Resources