I am in the introductory steps of teaching myself ASP.Net MVC 4 with the intent of converting old Classic ASP code. So, I have made a simple Hello World application in MVC4 and want to deploy it to our development server. The development server currently mirrors our production environment. The production environment hosts a bevy of Classic ASP pages, hosted in the "web" directory.
I have used the publish button in VS to upload the hello world page to the dev server, dropping it into the "web" directory. So, within the "web" directory, there are 2 new folders /bin and /Views. The actual page I created resides within the /Views/Home directory.
After the code was uploaded I pulled up IE and attempted to view the hello world page by navigating to localhost/views/home/index.cshtml and I received a 404 error.
I then pulled up the directory listing in IIS and navigated down to the "home" directory. I right-clicked this folder and selected "convert to application".
At this point I was able to see my hello world page by directing IE to the root localhost. However, after removing the "home" directory from the application list (essentially undoing the "convert to application"), the hello world page still shows when I pull up the root directory in IE. I've checked the default pages list in IIS, and my Classic ASP homepage still lists as the first selection.
So, I'm kinda confused on how to make MVC and classic asp play nicely together. First and foremost, I'd like to get my dev server pointing back to it's original default page so that it matches the production environment.
Create a separated directory for your MVC4 application beside the web directory. After this create a new web application inside the IIS console and point the source directory to your new application directory (set the new application's AppPool to integrated). Everything should work fine.
Related
I have a production asp.net mvc website that I have been modifying and publishing through Visual Studio Express 2013. I wanted to create a development environment so that I'm not making changes to the production site/database. So, I did the following:
cloned the database and called it db-proj-dev
copied the source files for the project into a new folder called dbproj.dev
added the dev proj (dbproj.dev) to the same solution as the production project (so that easier to copy code from dev to prod)
modified web.config to point to the cloned database db-proj-dev
created a new publish profile pointing to dbproj.dev under inetpub
added a new website in IIS manager, pointing to the folder dbproj.dev under inetpub (port 10000 and same url as the default website)
What is happening now is that, when I bring up the dev site, it comes up to the home screen of the dev site, but if I click any of the links, it redirects to the main prod site. If I complete a form, the data gets posted to the production database. Does anyone know what I am forgetting or missing?
It sounds like you have absolute links in there - http://yoursite.com/thing/somepage rather than relative /thing/somepage.
I have tried these steps but could not make it. When I browse my app it shows dll file.
Log onto the machine that is or will be hosting your application.
Use IIS Manager to create a new website for your application.
Create a new application in that site. I believe this also will automatically create an application pool with the same name for you and use it by default.
Specify the virtual directory for your application. This is going to tell IIS where to look for your mvc application. For this case lets assume it is C:\myApp
On your own machine Build the application however you build it with the correct solution configuration (i.e. Release mode). Lets say the result of your build is located at C:\MyProject\bin.
Copy C:\MyProject\bin from your machine onto your hosting machine at C:\myApp
I am a novice to this technology.
you shouldn't just drag the bin folder. it is everything else too like the images, css, jscript files as well as the cshtml files too (your views) to the c:\myapp folder.
or perhaps just do a publish within visual studio. maybe even take a look at this to see if this helps:
How to publish my MVC 3 web application onto IIS7
but generally speaking, I build the solution. I then create the vdir in my IIS. I copy the bin and view folder along with images/css/jscript/shared folders etc... to C:\my deployed site. I then convert to application for that vdir I just created in IIS.
You have to use publish action for ASP.Net web application(MVC, Forms and etc.)
I have been literally stuck for hours trying to deploy a Web API app to IIS. I can not believe there are no useful tutorials online anywhere that I can find. Here is my situation.
I have a VERY basic Web API app. It is using .NET Framework 4.0. It doesn't do anything I just want to see the home page at this point.
I am developing it in Visual Studio 2012 on my local machine. I can hit my localhost and see the home page, even post some data through Fiddler works great.
I publish the solution using Build->Publish to my local file system.
I then copy and paste everything in that directory to my web server (actually using a repository but for simplicity sake)
I created a brand new application pool in IIS. .NET 4.0 Integrated.
I placed the folder that contains my published code inside of the directory of my main website. The folder name is WebAPI.
I created a new website in IIS, attached to that new app pool I created.
I start the website, browse it on localhost and everything works perfectly.
I try to go to the website externally "website.com/WebAPI/api" and get a
403.14 - Forbidden The Web server is configured to not list the contents of this directory.
I'm sure I'm doing something wrong, I've never deployed an MVC app to IIS on another server. I'm able to deploy it just fine on my local machine through IIS too. What am I missing? Thanks!
Edit: Yes, my server has other .NET 4.0 apps running just fine.
http://localhost/api
http://website.com/WebAPI/api
Is this correct?
If so, looks like it could be a path problem.
I've created a MVC website using Visual Studio 2010 and would like to deploy it to my newly installed local IIS7. The website works perfectly running from Visual Studio on the development server that it comes with.
Here are the steps I've done:
1) Opened IIS7 Manager.
2) Under Sites created a new site called Foo.
-- I used the DefaultAppPool which is set to .net4 integrated
-- I created a empty directory and used it as the default path
-- I set the port to 54321
3) I then in Visual Studio used the publish button with local IIS and the site set as Foo.
IIS Manager now shows the following under sites:
Foo
bin
content
scripts
views
When I go to localhost:54321 I am given a message saying it can't list the directory. If I put a index.html file in this directory it will launch the file as expected. I guess I'm missing something big here. I published my site to this directory. When I go to localhost:54321 I expected it to launch the index view of the home controller, but it just tries to list the directory.
Found the answer here:
ASP.NET MVC on IIS 7.5
Can't answer my own question cause I have less than 100 points :)
The new server is missing the ASP.NET MVC 3.0. Install it using standalone ASP.NET MVC 3 installer.
i have an asp.net mvc website. http:/mywebsite.com (just for this example)
I have been testing this asp.net mvc website locally on my machine and everything works fine on my local machine during testing. When i deploy to my web server
when i bring up http://mywebsite.com it goes to HomeController and load the view Views/Home/Index.aspx (which is perfect). So the main default page is fine.
The issue is, if i click any other other links (again that all seem to work fine locally) i get the following error:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
* Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
* If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
* Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
some examples would be:
http:/mywebsite.com\Photos
http:/mywebsite.com\Links
there definitely are controllers and views setup for this (or it wouldn't work locally).
does anyone have any idea how this might work fine locally but somehow on the webserver it doesn't
Are you running the site on II7 in integrated mode? If not, you need to add a wildcard handler so that all URLs get mapped to your application. See Phil Haack's blog post on running ASP.NET MVC ON IIS 6.
Something else to watch out for. I had a static website - deployed on IIS 7.5. Added some MVC Controllers to handle some simple server side apps and then re-deployed it. I didn't copy the web.config file, because I wrongly assumed that everything that was needed was in the one that was automatically created by the server.
You must copy the web.config up as well.