ASP.NET MVC 2 site issues when updated IIS7 to .NET 4.5 - asp.net-mvc-2

I have a web app running ASP.NET MVC 2 along with other sites (using ASP.NET MVC 4), updated IIS7 to use .NET 4.5 and my MVC2 app stop working properly:
Issue: (blocker)
There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined
the solution:
comment out a section of web.config, based on http://forums.asp.net/p/1571308/3939106.aspx:
Issue: (blocker)
Login stop working, the solution add this line <machineKey validation="SHA1"/> to web.config, based on Login fails after upgrade to ASP.net 4.0 from 3.5:
Issue:
One of the views is giving a Compilation Error:
CS0104: 'ContainerType' is an ambiguous reference between
'System.Web.DynamicData.ContainerType' and
'MVFleet2.Core.ContainerType'
on this line :
<%foreach (var specs in (List<ContainerType>)ViewData["ContainerTypes"])
This error never happened before the update, I know the obvious solution is to use the full name for the cast, but I'm looking for a solution so i can force the web app to run in the context of .NET 3.5 and bypass this issues, so i don't have to deal with this and probably more issues in the future... is this possible?

If you want to use the older version of the framework (.net 3.5), you need to change the Application Pool in IIS to run as .Net 2.0.

You should fully qualify the ContainerType type definition to MVFleet2.Core.ContainerType.ContainerType.

Related

How to make ASP.NET Core RC1 work with the GA SDK?

The previous non-GA versions of Service Fabric came with support (and template) for ASP.NET Core RC1. GA removed this support.
I have a project that depends on ASP.NET Core RC1. I would also like to update to the new SDK now.
I can get the asp.net service to run with the latest SDK without any significant changes to code. However creating a ActorProxy or ServiceProxy in the asp.net project fails with exception "The config package was not found". So my asp.net service is unable to communicate with the rest of the services in the application.
How can i fix the issue with ActorProxy and ServiceProxy on ASP.NET Core RC1 service?
Someone else discussed the same problem in the comments of Service Fabric documentation. Vaclav came up with workaround to the bug. Basically the client project requires ConfigurationPackage named "Config". Projects based on the old ASP.NET Core template didn't have the ConfigurationPackage.
For details of implementing the workaround, see:
https://azure.microsoft.com/en-us/documentation/articles/service-fabric-get-started/#comment-2601127160

BreezeJS and Entity Framework 6.0.1

I'm trying to create a Breeze Web API controller and I'm wondering if it is possible with the default MVC/Web API project template that comes with Visual Studio 2013. Updating everything through the Nuget packet manager installs Entity Framework 6.0.1. Attempting to installing Breeze after that results in an error as it attempts to install EF 5 as a dependency, which is not possible given the fact that other parts of the template depend on EF6.
Do we have to wait for a new version of Breeze that works with EF6?
Edit: I want to do this the "breeze way" using [BreezeController] and Odata.
I just wanted to add that even without EF6.1, the MVC 5 updates released today with VS2013 also break breeze. It's hard to separate the pieces to determine which new piece is responsible. It could be MVC or the new odata. In any case, we anxiously anticipate the new version.
Updated 10/29/13
As of now, Breeze 1.4.5 has support for Microsoft's ASP.NET WebApi 2 and Entity Framework 6. Please see http://www.breezejs.com/documentation/download.
Older post:
We don't yet support EF6 but it is coming ... soon...
There is a new package called Breeze.WebApi2 that is compatible with Web API2 and EntityFramework 6. It makes some of the existing Breeze packages obsolete. See http://www.breezejs.com/documentation/start-nuget for details.

ASP.net MVC configuration issue without mod_mono

We're developping an MVC .Net website supposed to run on linux.
It worked fine with mod_mono but we're forbidden to actually use mod_mono on the production server for performance matters. Also, we use mono-fastcgi-server2 and mod_fcgid.
So when disabling mod_mono, the home page still works fine but any request like /controller/action ends up with a 404 error.
I wonder if we can even run our MVC .Net website without the mod_mono ?
This is my first question on this website and I am not very familiar with apache and the modules. Thanks for any help.
Probably not.
mod-mono is the Mono project's ASP.NET module for Apache. Without it, there's nothing in Apache to interpret any ASP.NET content. So, by extension, if you're not allowed to run mod-mono on your Apache server then you're not allowed to run ASP.NET on your Apache server.

Deploying Hybrid ASP.NET webform and MVC project on iis7 - MVC Routing does not work

Hi Stackoverflow,
Im trying to deploy a hybrid ASP.Net Webform/mvc-project onto iis7 but the mvc routing does not work.
This is what i have done so far:
Added all required mvc-related dlls.(i have double checked bin-catalog to make sure that everythings there on the deployed installation)
Added MVC wildcard by adding the IsapiModule handler to iis handler mappings.
The Server has .Net-Framework 3.5 SP1 installed.
The web site Managed pipeline mode set to classic
Our project requires the app pool to be running in none-integrated pipeline, but im not sure what MVC requires of the app pool, may i run ASP.NET MVC(2) in a none-integrated managed pipeline?
The web application loads and i want to use the MVC-routing to load javascript but the mvc routing does not responde to the request and instead Webforms gives us a 404-response,
this only happens when the project has been deployed onto the server.
Does anyone has a idea of why the ASP.Net MVC routing does not fire?
Thanks and Best regards,
Mikael
I found the error, the installer did not update production web.config,
so there was some missing mvc-required references,
i used this article to find out what was missing, it describes how to setup a hybrid WebForm/Mvc project in a simple way.
And now im able to run a hybrid webform/mvc-project on iis7 classic without any problem.

Call between ambigious RenderActions

I recently uploaded my ASP.NET MVC 2 Preview 2/.NET 4 application (Built using VS 2010 Beta 2) to MaximumASP.com's beta websites and when I try to run it I get the following error:
CS0121: The call is ambiguous between the following methods or properties: 'System.Web.Mvc.Html.ChildActionExtensions.RenderAction(System.Web.Mvc.HtmlHelper, string, string)' and 'Microsoft.Web.Mvc.ViewExtensions.RenderAction(System.Web.Mvc.HtmlHelper, string, string)'
This error doesn't show up on my developer machine (Windows 7, VS 2010). Any idea what could be causing this?
UPDATE
I made sure that the .dlls I uploaded with my project are the ones that are working fine with Visual Studio 2010 Beta 2, but I still get the same error when I upload it to my host.
My host is using the newest version of ASP.NET MVC 2 (Beta), but I'm referencing the old Preview .dlls in my web.config and uploading them in the BIN folder, but still nothing.
-
In my case, removing the reference to the old Microsoft.Web.Mvc library from ASP.NET MVC 1 solved the problem.
MVC is NOT supported in VS2010 ... So is this Preview 2 (Although RenderAction is part of MVC2 Beta?)?
http://haacked.com/archive/2009/11/17/asp.net-mvc-2-beta-released.aspx
Unfortunately, because Visual Studio
2010 Beta 2 and ASP.NET MVC 2 Beta
share components which are currently
not in sync, running ASP.NET MVC 2
Beta on VS10 Beta 2 is not supported.
Can you give us the output of typeof(Controller).Assembly.GlobalAssemblyCache, both on your dev machine and on your host? If your controller code is able to run, you can just Response.Write() it, then Response.End(). This will cause your view not to render, so hopefully you can avoid that error.
Edit:
Since your hoster has GACed the MVC binary, you need to compile your site against the same version of the binary that your hoster is using; bin-deployment won't work. If your hoster has installed MVC 2 Beta, you need to compile your site against the MVC 2 Beta binary. Unfortunately this means that you'll have to compile your site with VS2008 + MVC 2 Beta, as VS2010 Beta 2 includes MVC 2 Preview 2, which is an earlier version than what your hoster has deployed.
As a completely unsupported workaround that might make MVC 2 Beta run on VS2010 Beta 2, check this comment on Phil's blog. Note that I mean completely unsupported - it might affect other parts of VS, prevent uninstallation and require reformatting the machine, cause your machine to turn radioactive, etc.
Alternatively, smack your hoster for GAC-deploying Beta binaries and get them to un-GAC it. :) Then you can bin-deploy the particular binary you're compiling against.
Two things I can think of; First, you could make sure not to import one of the namespaces on all of the pages (eg, remove Microsoft.Web.Mvc.ViewExtensions from any <% Import %> statements and from the system.web/pages/namespaces area of the web.config. This unfortunately means that you can't easily reference the extension methods in that assembly however.
An alternative option provided on the MSDN forums would be to write an extension method of your own that just wraps the one you want to call and has a completely different name (eg, BaddieRenderAction()).
Neither option is all that great, but with the second option at least you can get up and running easily and then in the future when MVC 2 is released and your providers GACed assemblies don't cause a problem, you can do a Search and Replace for "BaddieRenderAction" -> "RenderAction" and it's all fixed.
Rather than wrap the Render Action, just explicitly call the extension method as follows:
Microsoft.Web.Mvc.ViewExtensions.RenderAction(Html, ...)