Running an ASP.NET Web Application on Apache with Mono - asp.net

I have developed an ASP.NET web application that has the following files (after being published): Default.aspx, Web.config, .dll (in bin folder), .pdb (in bin folder), and an App_Data folder that currently has nothing in it. This application runs well in Visual Studio.
My company uses Apache so the IT department decided to try Mono to run my application. Unfortunately, the application does not run. A question that was asked of me was where the .cs file was located. Out of the output files, after publishing, I cannot seem to find the .cs file that the .aspx file is suppose to refer to. Am I missing a file out of the list that I provided above?
Also, does anyone know soem rules of thumb or processes for getting an ASP.NET web application to run through Mono. I just need some direction.
I really appreciate everyone's feedback on this.
Thank you,
DFM

You need to install mod_mono on Apache. There is more information about this on the Mono ASP.NET page. The .cs is compiled into the DLL is not needed at run-time.

The .cs files would be compiled into the DLL, so they are not needed for deployment. Other than that, we would probably need some more information to figure out why the app won't run under Apache/Mono.

Related

VB.NET ASP.NET Web Application. Advice on getting ready for deployment

I was hoping for some advice on the correct approach to get my asp.net vb.net web application project completely ready for deployment. I recognise that I switch to release mode and compile. So I have my server-side code successfully compiling into a .dll file in the BIN folder, this is exactly what I want.
The issue where I am unclear is with the aspx.vb files and the aspx.designer.vb files that are attached to the .aspx files, I am using VS2010. I want to remove all of these from my project so that any of our potential clients have no direct access whatsoever to any of the server side code.
I have decompiled the .dll file and can see that it is all in there so I am fairly certain if I remove the code behind files the program will run without any difficulties. As I have never done this before I was hoping for some basic tips. Is this the correct approach to take? If so is there a standard good approach for removing the aspx.designer.vb files and the aspx.vb files from a given project within Visual Studio, or is it a case of manually taking them out of the release mode?
Thank you for any tips.
The code behind files are compiled into the dll in a web application so you don't need to deploy the .vb files (nor do you want to).
The dll is not obfuscated by default so anyone could decompile it to see your source however. There are free and non-free obfuscators available but that is outside the scope of this question really.
The easiest way to deploy is to use visual studio to do this for you (I think you might need pro version or above)
You can set up your own test web server locally and deploy to that first to see which files are in there.

Decompile Asp.Net web site Project

we have an application in production and the code is in Pre-Compiled form. And I could'nt reach any source code. I searched a few web site, they suggest Reflector so used Reflector to get code behind files. I reached cs files and add them by changing the asp.cs. But I do not reached aspx.degigner.cs files. And when I build my project Dll files do not compile. Their modify date seen old date. I make a mistake I know but I could not solve this problem. Have any ideas on this issue?
You can easily recreate your designer files by right-clicking on your Web Application Project and choosing "Convert to web Application"
You can find the compiled binaries in the ASP.NET Temporary Files location.
%SystemRoot%\Microsoft.NET\Framework\versionNumber\Temporary ASP.NET
Files

Recover ASP.NET Project from IIS Deployment

I'm a real newbie for ASP.NET web development, having a background in Java. A friend has an ASP.NET 3.0 deployment running on IIS. He can't find the original project files created in Visual Studio 2008 and has asked me to give him a hand.
Is it possible to recreate the project from the deployment on IIS? I see lots of ASPX and and CS files so in the inetpub[domain]\httpdocs directory.
I don't see the .SLN file. I assume that's what he needs. Would it be a real chore to rebuild? Are there any assets or source files that won't be deployed to ISS that I'd need to recreate?
Thanks
Re-creating the soloution/project files is (potentially) a small part of the recovery. Do you see any .aspx.cs or .aspx.vb files on the web server? If not, you'll need to extract the code from the code for each .aspx file from the DDL's in the web site's /bin folder. You can reverse engineer any .Net code quite easyily luckily with reflector, however all comments will be lost.
If you have the aspx and the cs files, you are in business: all you need to do is create a new Web Project in Visual Studio and select "Add Existing Files". You would then select all your aspx pages only and the cs files should get automatically imported for you.
Obviously, as anything, you'd probably have some references missing and what not, but shouldn't be incredibly painful to fix all those issues.
If it's a compiled web application project the code will be in a compiled assembly in the bin folder. This can be decompiled with .NET reflector. The source will be readable but not as original.
If it's a website project you're in luck. The code files will be in the website structure (*.aspx.cs or *.aspx.vb). These will constitute pretty much all of the assets you need to recreate the site in Visual Studio. Creating a project and solution file to manage these in VS will be the easy bit.

Must I upload compiled .dll files to get a asp.net site to work?

Sorry if this sounds like a noob question.
I downloaded this asp.net project from the live server - the client said it has everything needed to run. I don't know what version it is, but it doesn't have .designer.cs files, only .cs files, so I guess it's pretty old.
When I open the project in vs2008, it gives a lot of errors, so I can't compile it locally.
The questions is:
As I need to make changes in .cs files, do I only need to upload the .cs files to get it to work? Don't I need to compile the project and upload the .dll files??
Thank you!!
It sounds like you may have a "web site" type project:
Difference between 'Web Site' and 'Project' in Visual Studio
Is there a csproj file? If not, then you can be pretty sure that it is. This project type compiles dynamically, so the cs file is present on the server. I don't care for this type personally, and would convert it to a web application, but that's just me.

ASP.NET Web Deployment Projects: getting rid of .compiled files

I'm using a Web Deployment Project in Visual Studio 2008 in order to prepare my ASP.NET application (ASP.NET web application, not ASP.NET web site) for being copied to several servers. I have to copy the files on local staging servers, on different servers via FTP and sometimes I have to fetch them from customers' servers.
So, it would be nice to have all files for deployment in a compact form without the necessity of doing a lot of comparing between source and destination. Web deployment projects have this nice feature: compile all your aspx and ascx files into a single (additional) assembly.
I somehow found out how to get rid of aspx placeholder files on the server, now I'd like to know if there is a (maybe self-made) way to get rid of these .compiled files.
From Rick Strahl's blog:
The .Compiled file is a marker file
for each page and control in the Web
site and identifies the class used
inside of the assembly. These files
are not optional as they map the ASPX
pages to the appropriate precompiled
classes in the precompiled assemblies.
If you remove the .Compiled file, the
page that it maps will not be able to
execute and you get a nasty execution
error.
Anybody out there with a creative idea, maybe using a module/handler which intercepts the check against the .compiled files in the bin folder?
The .compile file comes from pre-compiling on deployment. So you basically have 3 options:
Keep the .compiled file
Don't pre-compile and deploy source code
Turn this in to a Web Application instead of a Web Site and compile as an assembly
I have run in to the same problem myself. I actually choose #1 in most cases when dealing with deployment of Web Sites, but on the rare occasion when I know I am going to have to maintain the site for an extended period of time, I take the time to upgrade it to a Web Application.
I don't like the .compiled files either, but nobody gets hurt if they're there. So why bother?
You might want to take a look at Virtual Path Providers (KB how to here) in ASP.NET.
Credit for this suggestion must go to Cheeso and his self answered question here:
Can I get “WAR file” type deployment with ASP.NET?
I don't know about the .compiled files, but you could set up your servers to update their files with subversion instead of manually copying the files when you compile.
So you would compile the files using the Web deployment project (not into a single assembly), put them in a repository you created for this purpose, and on each server, just do an svn update to fetch and compare the files automatically.
I know it's not what you asked for directly, but it may be a path to explore.
Add "Exclude Filter" to your deployment project:
In the Deployment Project.
Right Click on Content Files.
Click on "Exclude Filter".
Add "*.Compiled"
click OK.
and thats it.
I remember at the days when I cant do Web Application with VWD Express, I use nant script to compile the project into a single dll and deploy, that would work (so I dont need the full VS to do dll deployment too), so if you really don't want to mess your project to Web Application, maybe this is a path to check too.
You can get rid of the .compiled files by using the aspnet_merge tool with the -r option.
Removes the .compiled files for the main code assembly (code in the App_Code folder). Do not use this option if your application contains an explicit type reference to the main code assembly.
If you publish your code as updateable (in publish settings) these files are generated. Uncheck that value and republish. This is an old question I know, but no answers are clearly defined for this here.

Resources