ASP.NET MVC with Mono - asp.net-mvc

I'm trying to develop an app with ASP.NET MVC Mono.
Installed latest version of Mono and Monodevelop. While trying to run a default "Welcome to ASP.NET MVC on Mono!" app I get the following errors:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Mvc,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file specified.
Source Error:
Line 34: Line 35: Line 36: Line 37: Line 38:
Source File: C:\Users\Sergey\Desktop\mvc\mvc\web.config Line: 36
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'System.Web.Mvc, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:2.0.50727.4927;
ASP.NET Version:2.0.50727.4927
Tried putting System.Web.Mvc.dll from C:\Program Files\Mono-2.10.6\lib\mono\2.0 to bin\ - app still doesn't run, I just get
The located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
instead of
The system cannot find the file specified.
What should I do?
P.S. My OS is Windows 7.

As suggested in the comment, I'm posting this as an answer ;) When trying to run application which references Mono's assemblies, one can try running it with Mono (not .NET what MonoDevelop does as default) as it uses different GAC.

Related

Autofac 3.4 is missing, while 3.5 is called

Attempting to run the MVC 5.2 project, which is built successfuly, got the following error:
An exception of type 'System.IO.FileLoadException' occurred in
ProjectNamespace.WebUI.dll but was not handled in user code
Additional information: Could not load file or assembly 'Autofac,
Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
Assembly manager loaded from:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under
executable C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: DisplayName = Autofac, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da
(Fully-specified) LOG: Appbase = file:///C:/ProjectPath/WebUI/ LOG:
Initial PrivatePath = C:\ProjectPath\WebUI\bin Calling assembly :
Autofac.Integration.Mvc, Version=3.3.0.0, Culture=neutral,
PublicKeyToken=17863af14b0044da.
=== LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using host configuration file:
C:\Users\me\Documents\IISExpress\config\aspnet.config LOG: Using
machine configuration file from
C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Autofac, Version=3.4.0.0, Culture=neutral,
PublicKeyToken=17863af14b0044da LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
ASP.NET Files/root/5c8bedab/6a36492/Autofac.DLL. LOG: Attempting
download of new URL
file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
ASP.NET Files/root/5c8bedab/6a36492/Autofac/Autofac.DLL. LOG:
Attempting download of new URL
file:///C:/ProjectPath/WebUI/bin/Autofac.DLL. WRN: Comparing the
assembly name resulted in the mismatch: Minor Version ERR: Failed to
complete setup of assembly (hr = 0x80131040). Probing terminated.
My web.config has the following settings:
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
Spent hours trying to resolve it, but failed. Please help.
This problem has become quite common. It seems to come up when you have the Autofac, Autofac.Mvc5 and Microsoft.AspNet.Mvc>5.1.0 packages, even though Autofac.Mvc5 is stated to work with Microsoft.AspNet.Mvc(≥ 5.1.0 && < 6.0.0).
I suggest the classic solution of checking and adding the appropriate assembly binding redirects for autofac, not only in the project which references it but in projects referencing that project as well.
Another potential problem is having two entries for the
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
in your config, if you have your bindings in the second one move them to the first one. That fixed it for me in a situation where I was also encrypting some configuration settings and for some reason the binding redirects were not copied into the resulting config file.
I highly recommend the Assembly Binding Log Viewer, it helped me a lot in figuring out the issue, even though my final solution was a cowardly one, going to Autofac3.4.0.0 and Microsoft.AspNet.Mvc 5.1.0. I spent way too much time on fixing the problem.
Also, for those who are interested you can use the nuget manager to detect and fill in your assembly binding redirects: Get-Project -All | Add-BindingRedirect (from here). It might need some additions afterwards depending on your porjects and references but at least it's going to give you a clean slate to begin with.
Update
Microsoft.AspNet.Mvc 5.2.3 was released so I decided to try again. I updated every package involved in the "conflict" to the latest version (Autofac 3.5.2, Autofac.Mvc5 3.3.4, Microsoft.AspNet.Mvc 5.2.3). I updated the redirect bindings and it worked.

Error creating a DevExpress controls for ASP.NET MVC empty project manually

I am using Visual Web Developer 2010 Express. I need to use DevExpress controls for an ASP.NET MVC 4 project.
So, I downloaded DevExpress Universal Edition something that has ASP.NET MVC controls.
Since I do not see a DevExpress ASP.NET MVC Empty project template, I am manually creating one following the instructions provided here:
http://documentation.devexpress.com/#AspNet/CustomDocument8163
However, when I start my application, I get this yellow screen of death that says:
Configuration Error
Description: An error occurred during the processing of a configuration file required
to service this request. Please review the specific error details below and modify
your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'DevExpress.Data.v12.2,
Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' or one of its
dependencies. The system cannot find the file specified.
Source Error:
Line 39: <compilation debug="true" targetFramework="4.0">
Line 40: <assemblies>
Line 41: <add assembly="DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
Line 42: <add assembly="DevExpress.Web.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
Line 43: <add assembly="DevExpress.Web.ASPxHtmlEditor.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
Source File: C:\Users\computer\Documents\Visual Studio 2010\Projects\MvcApplication5\MvcApplication5\web.config Line: 41
Assembly Load Trace: The following information can be helpful to determine why the assembly 'DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' could not be loaded.
=== Pre-bind state information ===
LOG: User = computer-VAIO\computer
LOG: DisplayName = DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
(Fully-specified)
LOG: Appbase = file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/
LOG: Initial PrivatePath = C:\Users\computer\Documents\Visual Studio 2010\Projects\MvcApplication5\MvcApplication5\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\computer\Documents\Visual Studio 2010\Projects\MvcApplication5\MvcApplication5\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
LOG: Attempting download of new URL file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET Files/root/8847955d/8ce8b26b/DevExpress.Data.v12.2.DLL.
LOG: Attempting download of new URL file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET Files/root/8847955d/8ce8b26b/DevExpress.Data.v12.2/DevExpress.Data.v12.2.DLL.
LOG: Attempting download of new URL file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/bin/DevExpress.Data.v12.2.DLL.
LOG: Attempting download of new URL file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/bin/DevExpress.Data.v12.2/DevExpress.Data.v12.2.DLL.
LOG: Attempting download of new URL file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET Files/root/8847955d/8ce8b26b/DevExpress.Data.v12.2.EXE.
LOG: Attempting download of new URL file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET Files/root/8847955d/8ce8b26b/DevExpress.Data.v12.2/DevExpress.Data.v12.2.EXE.
LOG: Attempting download of new URL file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/bin/DevExpress.Data.v12.2.EXE.
LOG: Attempting download of new URL file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/bin/DevExpress.Data.v12.2/DevExpress.Data.v12.2.EXE.
It looks like the DLL versions I have and the ones mentioned on that page are different. Please help.
I ran my project through their project converter which scans your references and web.config files and upgrades the entries to reflect the latest DLL's (if the ones you have are later than the ones you are pointing to in the web.config file), which was the case for me because I just copied the references from that page.
It says you're missing the data assembly. You seem to be using an old version. Download the latest version as there is an empty project template in the DevExpress project wizard.
Also, contact the DevExpress support team and they can help you quicker.
Please take a look at this:
How to: Manually Register DevExpress Extensions to Start Using Them in an MVC Web Application

Could not load assembly WebPages.Deployment version 2 at host?

I have a ASP.NET MVC 2 website (VS2010) that I have upgraded to ASP.NET MVC 3 (VS2012) and this works fin on local IIS7 but when publishing it I get this exception on host :
Could not load file or assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
After some seartch I found this that states that I should set CopyLocal on some of the references(inlcuding the System.Web.WebPages) and also use the publish tool in VS2012, but this generated the following exception?
Could not load file or assembly 'System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
And I can´t find any Deployment dll to set copyLocal?
How could I solve this?
Have a read of http://joel.net/getting-asp.net-mvc-3-working-on-discountasp.net
You need to add a reference to System.Web.WebPages.Deployment and set that also to CopyLocal.

FSlex/FSyacc crash - can't locate FSharp.Core assembly

I'm having an issue with FSlex/FSyacc crashing on my machine.
In context this is inside Visual Studio 11 beta running on Windows 8 Consumer Preview (32 bit) running inside a Parallels virtual machine.
------ Build started: Project: Basis, Configuration: Debug Any CPU ------ C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1546,5):
warning MSB3245: Could not resolve this reference. Could not locate
the assembly "log4net, Version=1.2.11.0, Culture=neutral,
PublicKeyToken=669e0ddf0bb1aa2a". Check to make sure the assembly
exists on disk. If this reference is required by your code, you may
get compilation errors. Basis ->
C:\Users\nexus\Desktop\Statical\trunk\Statical\Basis\bin\Debug\Basis.dll
------ Build started: Project: Syntax, Configuration: Debug Any CPU ------ cd C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\ CALL C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\fsyacc.cmd CALL
C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\fslex.cmd
Running fsyacc.cmd... CalParser.fsp Running fsyacc.exe... Unhandled
Exception: System.IO.FileNotFoundException: Could not load file or
assembly 'FSharp.Core, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified. File name: 'FSharp.Core,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at .$FSharp.PowerPack.FsYacc.Driver.main#() WRN:
Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog]. Running fslex.cmd... Not
running fslex.exe as CalLexer.fs is newer than CalLexer.fsl
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1036,5):
error MSB3073: The command "cd
C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\ CALL
C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\fsyacc.cmd CALL
C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\fslex.cmd"
exited with code -532459699. Done building project "Syntax.fsproj" --
FAILED.
The relevant piece seems to be this:
Unhandled Exception: System.IO.FileNotFoundException: Could not load
file or assembly 'FSharp.Core, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified. File name: 'FSharp.Core,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at .$FSharp.PowerPack.FsYacc.Driver.main#()
Not sure why it can't locate the FSharp.Core assembly.
Ideas?
I had forgotten to install F# 2.0. There was a dependency on that.

How can I get a fusion binding log on a host that does not have it enabled?

I'm trying to run an Asp.net MVC 1 app on a host that doesn't support MVC per this post but does support .net 2,3,3.5
However the error message I get back doesn't tell me much:
Server Error in '/assetmanagement' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'TryHTTPHandler' or one of its dependencies. The system cannot find the file specified.
Source Error:
[No relevant source lines]
Source File: D:\Hosting\4582955\html\web.config Line: 65
Assembly Load Trace: The following information can be helpful to determine why the assembly 'TryHTTPHandler' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.4049
A google search or stack overflow search for TryHTTPHandler seems to turn up almost nothing.
line 65 of my web.config is as follows:
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/>
I've turned on copy local for System.Web, System.Web.Mvc, System.Web.Routing, and System.Web.Abstractions. I'm not sure how to determine if my host has .net 3.5 or .net 3.5 SP1.
How can I get the binding log or any other idea what's wrong with my configuration? I'm fairly limited on what I can do on the host since it's paid hosting.
If you read the error message closely, it tells you how to enable the fusion log: Since you don't have access to the host registry you'll have to try to reproduce the issue on a machine you do control
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Resources