Hosting an ASP.NET MVC site in a webhotel - c#

We are a group of students trying to host our project website in a webhotel, using a test server environment, before we decide to publish it.
However we are having trouble correctly publishing it to this environemnt, and have not been able to get help from the host support.
This is the folder structure for the test environment:
https://puu.sh/sP8Dq/b022c83f34.png
This is the folder structure for our project in Visual Studio:
https://puu.sh/sP8Gb/24e85dfff6.png
When we use FTP to upload our project into the httpdocs folder, along with the web.config, the site remains in the default state.
This is how the ftp server looks like:
https://puu.sh/sP8PE/26e3e45f4a.png
This is a first for us, so any help in how to host our site would be appreciated.

first of all you should be sure that your host provides the necessary tools to host a asp.net mvc application you need to ask this from your host provider, tell them what version of MVC your application is made of, and if its possible to host it there, there are afew issues with lower versions of plesk.
as what you have to do so your website comes up :
you have to copy the whole mvc project into httpdocs folder to view it online.
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.

Related

publish asp.net mvc5 without installing visual studio

Finally, i have completed my asp.net mvc5 project.
I have used EF code first for database and my solution included two part, the core included Model and frontend included the views and the controller.
Now i want to send the project to my friend that he can publish it in his windows server with IIS server.
My question is which file i have to copy for him that he can publish the WebApp with out installing visual studio in his windows server.
Right click on main MVC project in your solution -> Publish.
Publish method: File System
Target location: your location
In settings Configuration you can set Release or Debug as you need.
After publish you can send whole folder to your friend. Everything that you need should be there (Your bins, views, scripts, css).
Your friend should just create new WebSite in IIS and place all files in folder that he selected.
Ofcourse he should change connection strings and set right settings for ApplocationPool that runnig WebSite.

500 Server Error, Don't know Why

I made a virtual machine on azure to host my asp.net mvc 5 website. I made a directory in iis on the machine and pointed it to my domain. I first put the default iis.html page and went to it. This works.
Now I put all my asp.net mvc code in that folder and I get "500 server error". I don't know why.
I tried to put in my web config
<customErrors mode="Off">
Yet this did nothing. I don't know why it is failing nor how to check. There is nothing special with this website(just controllers and views...not even a database).
I am not sure if I need to install anything more to get it to work. The vm is windows server 2012.
Follow these steps:
Verify installed MVC version in the server (windows\ assembly folder)
Verify application bin folder which should contain appropriate dll(s) (website/ virtual directory maps to a physical folder, bin should be under the root with required binaries)
Also verify MVC views ('Views' folder should be just under the root)
Verify Web.config, which should be updated properly
Application Pool should be running under appropriate .Net version (Run -> inetmgr -> Application Pool -> Advanced Settings -> .Net Framework Version)

What is contained in a published ASP.net project?

I developed a site in asp.net using C# as the language.
I have debugged it and no more errors can be found and can also view the page from a browser.
I would like to host this site and direct a client to it for demo purposes but am having a problem each time I publish my site. The publishing only does away with all my .aspx.cs files but I don't see any .exe file that I can install or send to my hosting provider.
I would like to know if this what I am experiencing is normal or there are settings I need to do in my visual studio 2013 ultimate edition for these tasks to be performed?
Kindly advise me on the way forward
ASP.NET applications (not "ASP.NET websites") are compiled into a .dll file in your bin folder, which is then deployed on to the server.
Your .aspx/.cshtml1 files reference compiled classes and types contained within this DLL, thus eliminating the need for source files.
There won't be any .exe files, you need to deploy your project to a web server, like IIS. Check out this link.

ASP.NET site throws compilation error on webserver

I am working on a webserver that has ASP.NET 2.0 as the activate instance of ASP.NET (I can't change it. I don't have control over it.)
I orginally wrote the site in 4.0, not even thinking to ask what version the webserver was in. When it came to installing, I realized the error and changed the targeted framework. After a little bit of wrestling with VS 2010, it compiled fine.
I put it up, and now it is giving me this error:
Account used to be a .cs file, which I then put into it's own project so I could get in a DLL in hopes of it working with it being a dll. It always fails when it comes to the first thing that references Account.
Account is compiled against .NET 2.0.
Any help? D:
Edit: The other important thing that may change this, is that the person is already hosting another ASP.NET site on the main folder. He wants to host this site in a subfolder.
I have read that ASP.NET may not like that, so could that be the issue?
Check following:
Your application referencing assembly with Account class;
Corresponding assembly existing in web application 'bin' directory - you may referenced it, but not specified as 'copy always' in reference properties.
You built it, not just put into 'App_Code' (it is bad practice to put code in the App_Code for asp web application as I know)
Also, your error appeared only on 'production' host or reproduced also on VS devserver?

How do I unpublish a .Net application

I published a C# .net application to the wrong folder. I am using VS 2005. How do I unpublish the app to be able to republish in the correct folder.
I tried simply publishing to another folder and now the app will not run from either location.
You will need to manually delete all the published files from the wrong folder.
There is no "recall"/"unpublish" function in VS. All "publish" does is compile and copy compiled files and other included files and folders (images, css, js etc) to the specified directory.
Publishing is essentially just a copy of the built application to the destination folder, as far as I aware. This points to a different problem in your application as being the source of your error.
More than likely your app isn't working from either folder because it's configured to use asp.net 1.1 or doesn't have asp.net installed at all on the server. If it is installed, and both 1.1 and 2.0+ are installed, it will default to 1.1, and the folder needs to be configured to use 2.0+.
But other than that, you just delete the files from the server by hand.
Publishing function also creates "Application" on the IIS, so I would probably start by opening the IIS server with "Internet information services manager", and remove the application with the wrong folder.

Categories

Resources