MVC4 Application on Azure not working - asp.net

I am deploying a ASP.NET MVC4 to Azure web site for the first time.
Stack:
Visual Studio 2013 Professional Update 1
.NET 4
ASP.NET MVC 4
Using Razor
IIS7
I have downloaded publish profile and have imported in Publish settings. Build is successful so is deploy.
When I go to home page i.e. mywebsite.azurewebsites.net/ I get: This web site has been successfully created message.
When I try going to /Account/Login => I get 404.
When I run /test.aspx (this is page I have added to project for testing) it executes and returns the page output.
I had same issue when I tried deploying MVC application to IIS6, where extensionless path was not handled so I had to enable wildcard handler.
How to resolve MVC issue on Azure?
Update 1
I have created a new ASP.NET MVC 4 project (Razor) using .NET 4.5. I have installed latest Azure SDK for Visual Studio 2013. So, this is empty project created from Visual Studio template, I have not did any further adjustments and it works on local IIS. I did a deploy according to Azure documentation.
Result:
403 on home page.
404 on Home controller url (http://mywebsite.azure.site/Home)

I found the problem.
I had "Precompile during publishing" checked in "File Publish Options". It was generating PrecompiledApp.config and Global.asax was missing.
When I have unchecked "Precompile during publishing" option, everything was fine.

I think you need to change your routes in RouteConfig.cs . I see you are trying /test.aspx , but I would try a restful folder. Look in your Controllers folder.
for example if you see:
Home
Then I would try mywebsite.azurewebsites.net/home
I see you are trying Account/Login I would NOT do this to troubleshoot as you just may have added complexity to your problem with AUTH...
Your routes are definitely needing to be looked at. Also locally you may want to run on IIS Express or your local IIS etc... and test different controllers.
The tweaking of your routes can easily cause the Account/Login to show this error locally
The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".
And then on publishing,... the 404 --> "An error occurred while processing your request." etc..
I like to use Visual Studio Publish, just install the azure sdk for vs 2013 etc..
https://azure.microsoft.com/en-us/documentation/articles/web-sites-deploy/

Related

How to publish ASP.NET Core 5 Web Site to IIS?

I installed Visual Studio 2015 RC and created the sample Web Site project.
I published it in Visual Studio using its publishing tool to file system. The output is:
I tried to target IIS both this folder and wwwroot folder but nothing changed. I always receive an Access is Denied error.
Checked the permissions. They are OK. I'm always able to run my other web sites...
I want to publish it targeting clrcore. But I already tried to publish it using clr and failed there too. It is the same error.
How is the publishing process should be when I want to run a coreclr website in IIS? And I don't even know if it is possible to serve a coreclr project on IIS.
By the way there is nothing about .NET Core in application pools dialog in IIS. So I don't know what could my poor IIS do here.
There are full instructions from MS:
http://docs.asp.net/en/latest/publishing/iis.html
TL;DR
You need to install HTTP platform Handler. Other than that, if you could get a standard MVC 5 app to work, you should be ok. The only change I needed to make was installing the plstform handler.
Of Course, In VS I publised to a folder, then copied the contents to the Web server. The root folder to the site must point to the wwwroot and the approot will be at the same level.
As far as I know, You can't host ASP.NET Core 5 Web Site on IIS, it works with self hosting only.

Recreating solution file in Visual Studio 2010

I need help re-creating a web solution file (at least I think that is what I need). I inherited a web application from another developer that left our company. It was created in Visual Studio 2010 and uses ASP.Net 2.0. There was no solution file, so I created a web application project and manually added all folders and files into my new solution. I did not make any changes to any file in the web application.
When I run the app from within Visual Studio, it starts up to the default page fine, but when I click a link on that same page, I get:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could
have been removed, had its name changed, or is temporarily unavailable. Please review the
following URL and make sure that it is spelled correctly.
Requested URL: /SomeCompany/startProject.aspx
Version Information: Microsoft .NET Framework Version:2.0.50727.8009; ASP.NET Version:2.0.50727.8008
My original start location: http://mylocalurl:65212/default.aspx
Link on the default page: http://mylocalurl:65212/SomeCompany/startProject.aspx
If, after clicking the link and getting the error page, I can remove "/SomeCompany/", and successfully get to the page. But I've seen the previous developer run it in Visual Studio and click the exact same link with no problem.
I need it to have the /SomeCompany/ in the url and work just like the previous developer had it so I can maintain and debug it as needed. What am I doing wrong in re-creating the solution...or is it another setup problem that I am not thinking of?
You could have probably just used file -> open web site. It probably is not a Web Application. Visual Studio has multiple types of web projects. Visual Studio will create a solution for you that you can save after you open the website.
Web Application Projects versus Web Site Projects in Visual Studio

Publish Asp.net web application to ftp

i want to publish my asp.net web application to my hosting. i am using the publish feature in visual studio 2013 ultimate. it is publishing correctly but the website is not opening i am getting could not load type error, i have tried many different configurations.
in the publish section i have choose : publish to ftp, fill in the correct information for the hosting and finally i used these configurations:
[this is the error i am getting
what can i do to make it work?
i have figure it out. the problem was i need to put the web.config in the root directorie

Local IIS Website Errors

I am using Visual studio web developer 4.0, in which I am creating a locally ISS hosted website.
My problem is while I am opening the website from visual studio I am getting errors such as:
ASP.NET 4.0 has not been registered on the webserver. You need to manually configure your web server for asp.net 4.0 in order for your site to run correctly...
When I am trying to serve a debug website I am getting the error:
Unable to start debugging on the server. Could not start asp.net debugging. More information my available by starting the project without debugging.
Then I navigated to my startup page without debugging and then the error in browser is
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
I have tried registering asp.net with aspnet_regiis -1. I'm using windows 8.
You have two options:
Manually configure web server for asp.net 4.0
Reinstall .NET framework
Number two is recommended.

ASP.NET MVC 4 and Web API in Azure - No HTTP resource was found

Using Visual Studio 2012, I created a simple Windows Azure Project (Cloud project) for which contains a ASP.NET MVC 4 website. I didn't change anything to the template and I simply try to deploy it using Azure Website. I imported the "publishing profile" from Windows Azure Dashboard into my project and deployed (using Visual Studio).
At the very end of the deployment process I am getting the following message: "failed to open 'http://mysite.azurewebsite.net'. Exception:Class not registered". I can only click "Ok" on that dialog. Any idea why I am seeing this message?
When I look at the Output Window, I see that the deployment succedded. I go the a Web API url and I am getting "No HTTP resource was found that matches the request URI 'http://mysite.azurewebsites.net/api/values'". What puzzle me is that I can access that same url on my local environment.
What am I missing? Thanks!
I could access using my Azure website using ASP.NET Web API. If you use default MVC4 Web API template, please access "http://[yoursite].azurewebsites.net/api/Values/".
My Environment is below.
- Visual Studio 2012
- ASP.NET MVC4
You don't need to create a cloud project to use Azure Websites. You can simply create an MVC app and then use git deploy or even FTP to push the site to Azure
Make sure that you referenced the latest version of WindowsAzure related assemblies in your project.
Microsoft.WindowsAzure.Diagnostics 2.0 (and not 1.8)
Microsoft.WindowsAzure.ServiceRuntime 2.0 (and not 1.8)

Resources