How to re-build deployed ASP.net website? - asp.net

I'm connected to a customer's site. There is a bug in an ASP.net MVC site i'm trying to solve.
As i make changes in the various .cs files, the web-server is not changing it's behavior. It seems that the web-site is determined to use the pre-compiled .dll files in the Bin folder.
How can i instruct IIS to recompile the web-site from scratch, in order to pick up the live changes?
I tried deleting my own .dll file:
\Bin\Contoso.dll
But then the web-site crashes.
Note: i am asking how to do this without access to Visual Studio; otherwise i would have changed the web-application into a web-site and redeployed.

You will need to recompile the dll with your changes from your development machine and deploy them. MVC ( I mean asp.net application) uses dll not source code. In short , what you are asking is not possible.

Related

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.

Publishing web apps and websites

I understand that references are stored in the project (vbproj) file for ASP.NET web applications and the Web.Config (http://msdn.microsoft.com/en-us/library/37e2zyhb%28v=vs.71%29.aspx) for websites.
I have recently converted a website into a web application. I notice now that the web application will publish (using the Publish option) even if the version information is incorrect in the Web.Config, then when accessing the web application through a browser I get an error.
I was unable to Publish a website if the version of an assembly in the Web.Config was incorrect.
I read that web applications are precompiled (before publish) whereas websites are compiled the first time the website is accessed through a browser.
Therefore, I believe what I have said should be the other way around i.e. I should be able to publish websites with an incorrect version in the Web.Config (because they are not compiled) and I should not be able to publish a web application.
What am I missing?
After some further research; I have discovered that ASP.NET web applications are built using MSBuild and ASP.NET websites are built using ASPnet_Compiler.
ASPnet_Compiler looks in the Web.Config for referenced assemblies (add assembly tag) at build time, whereas MSBuild looks in the project file (vbproj) at build time.
Web applications are deployed without the vbproj. I believe the project file is used for linking. Therefore at runtime a web application uses the information in the Web.Config to identify assemblies to look for in the local bin folder and then the GAC (for aspx pages only)i.e. namesapces still have to be manually imported into the code behind partial classes.
If anyone has any comments or better answer then please post.

How do I host my Mvc web app using plesk panel?

I have registerd my own domain name and web hosting space too on parallels
thay are having there plesk control panel.
I know that for html pages I need to copy my all pages into httpdoc folder
But what about by MVC WEBSITE?
HOW DO I HOST IT?
CAN ANYONE HELP ME?
To expand on the previous answers;
You need to ensure you are copying your websites 'bin' folder.
You may also need to ensure that the MVC assemblies are in it.
When you installed MVC on your local machine several assemblies are registered with the GAC.
It may be that your host does not have all the required ASP.NET MVC assemblies installed; if not then you will see a configuration error.
As these assemblies are registered in the GAC, the bin folder will not contain them by default.
Make sure your project explicitly references the following DLLs and make sure the Copy Local property is true.
System.Web.Helpers
System.Web.Mvc
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
Microsoft.Web.Infrastructure
Rebuild your project and check the bin folder. These files should now be present.
Upload the contents of this folder to your host.
you have to copy the whole mvc project into httpdocs folder to view it online.
You are getting the 500 - internal server error may be because the mvc version differs in the server(i mean may be you are using mvc v4 and the server has mvc v2).
So just contact your hosting provider, i am sure you will get a good solution.
I had the same problem with an MVC5 app using ASP .NET 4.5. To solve it, I used the Visual Studio publish Tool (Image1) right clicking in the solution explorer.
Then the Web App was published successfully.
you copy the whole project into httpdoc , then u must enable wildcard ASP .NET mapping for the website , ask your hosting system admin , usually they can do that
I'd suggest (from Visual Studio) using the Publish utility to actually upload your website. Plesk Hosting offers support for Web Deploy which is probably your best option, or alternatively you can pick FTP. When you use Visual Studio's publish, it should (I think) include the dependencies you have (in case you had anything in the GAC)
Select the following assemblies:
System.Web.Mvc
System.Web.Routing
System.Web.Abstractions
In the Properties window, set Copy Local to True.
then upload bin folder in mvc to the server. this may fix the issue

Update pre-compiled files in ASP.NET

After publishing asp.net web site, I got mant ASP_Web_xxxxx.dll.
After deploying these files to production server, how do I know which file to be replaced, if I modify one codebehind or .aspx file and re-publishing the web site?
Thanks.
It sounds like you are running a web site, and not a web application project. A website doesn't have a project file, and therefore doesn't create a single dll. Instead it created a bunch of smaller dlls. You don't have any control over which classes, etc are in which .dll.
When you deploy your web site, you will need to delete all of these dlls and move all of the new ones over. If you don't do this, you could potentially have 2 dlls that contain the same code, and you will run into issues with code being defined twice when you JIT.
If you can, I recommend you migrate your web site to a Web Application Project, so you only have one .dll you need to worry about. There are several tutorials out there including this one for VS2005.

Updating a DLL in a Production ASP.NET Web Site bin folder

I want to update a class library (a single DLL file) in a production web application. This web app is pre-compiled (published). I read an answer on StackOverflow (sorry, can't seem to find it anymore because the Search function does not work very well), that led me to believe that I could just paste the new DLL in the bin folder and it would be picked up without problems (this would cause the WP to recycle, which is fine with me because we do not use InProc session state).
However, when I tried this, my site blows up and gives a FileLoadException saying that the assembly manifest definition does not match the assembly reference. What in the world is this?! Updating the DLL in Visual Studio and re-deploying the entire site works just fine, but it is a huge pain in the rear. What is the point of having a separate DLL if you have to re-deploy the entire site to implement any changes?
Here's the question: How can I update a DLL on a production web site without breaking the app and without re-deploying all of the files?
The thing to remember is that there are web sites and web applications as far as Visual Studio and ASPNET is considered.
Web Sites typically have all of the aspx and vb files published to the live server and ASPNET Worker Process recompiles the app every time before presentation.
On the other end is the web application, where all of your code behind files get compiled down to a single DLL file and you simply deploy your aspx pages and you bin folder with the DLL file to production.
There is also a "hybrid" known as "Precompiled Web Sites" (see the link for the official MSDN overview) where you don't have the single DLL layout of a web application, but all the compile work of the website is done for you. There are several "modes" to this depending on your needs.
It seems to me that your error is caused because your site is set up as a web site with some kind of precompilation in place. Using the pre-compiled model is a little more "strict" in that is assumes certain files/signatures are in place. Having an updated version of the DLL file causes a break since the precompilation wants a name and a version of the file.
If possible, your best bet would be to convert to a web application, since you can add the additional DLLs into production without a problem. Otherwise, take a look at this matrix to see what form of precompilation you need for your application.
Look at this SO post, might be what you are referring to. The located assembly's manifest definition does not match the assembly reference
Have a look at your reference. Does it say "specific version = true" ? Set it to false, republish your app (you have to do it once, because now your app is still looking for an assembly with a specific manifest) and try it again.

Resources