Ninject 2.0 incompatibility with Server 2008 R2? - windows-server-2008

I'm dev'ing an MVC 2 website targeting .NET 4.0 and using Ninject 2.0 (dev box running Win 7 64 pro). All is going well on the dev side, I really enjoyed using Ninject and it works a charm.
Until I deploy it to the server. Once I deploy the app to the server (a virtual machine running Win Server 2008 R2 x64, IIS 7.5) the ninject binding appear to simply not happen. I was first getting a null reference exception on the Logger that I was calling in OnApplicationStarted, I manually bound that and I got another null reference exception the very next time the code called for an injected component. Manually changing that one pushes the problem down the line.
I'm not getting any errors at all locally, and I'm not getting errors in the event log other than the null reference exceptions on injected components.
I have already verified that the server has .Net 4.0, MVC 2's dll, both Ninject DLLs and the DLLs of all my components. I was compiling against "any cpu" as well, in release mode.
Any ideas or known bugs w/ the platform I've described?
I'd post source code except that I figured it's not relevant since it's working locally unchanged.

Ninject works fine on Server 2008 R2. If you are experiencing a difference in functionality between your machine and the server, then something is different in your setup. There is no way to help you with the information you have provided so far. Please create a sample project that exhibits the issue and it will be a lot easier to help you.
-Ian

Related

Do i need to install asp.net mvc4 on iis server

I am going to deploy my application tomorrow ,so i have few questions.I want to deploy asp.net mvc4 application on 2003 server where .net framework 4.0 is installed.My question is do i need to install asp.net mvc4 also there.Or if i copy the dll responsible for mvc in to that system is sufficient?
another question is i am using entityframework and oracle database so using ODP.NET, if this is the case do i need to install ODP.NET over there or just copying DLL system.dataaccess dll is sufficient?
Rest all i follow this two links will it work
The two links are http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx/
How to deploy MVC application in 2003 server IIS
UPDATE
today i tried and unfortunately i came to know that the framework which i was running .net 4.5 will not be supported in 2003.I made my project in to .net 4.0 and everything working fine in local system,but remote system lot of errors are coming.Method not found etc. I came to know that i have to degrade EF 5.0 to 4.4 i did it like replaced dll and changed one line begin with section but no luck as of now.I have to change somewhere else also.Do you know any proper mechanism which i need to carry forward for this?
No need to install anything explicitly except .Net 4.0. All you need is make sure that all dependencies (assemblies) of your application i.e. MVC, ODP.Net etc are present in bin directory of your application. Also make sure that ASP.Net v4.0 Web service extension is enabled in IIS.
Steps to enable web service extension.
Open IIS 6.0 Manager
Click Web Service Extensions
Enable ASP.NET 4.0
Check below screenshot.

Updating IIS website using WCF standard endpoints with Powershell

We have an ASP.Net website running under the 4.0 framework in IIS 7.5 on a Windows Server 2008 R2 box. A portion of the web site functionality utilizes WCF and has a "standardEndpoints" section in the web.config.
The website works fine and everything works fine if we want to use the IIS Management Console GUI to do things.
We would like to use powershell to make changes to the web.site but when we run "Set-WebConfigurationProperty" an error is generated indicating that the "standardEndpoints" section of the web.config can't be processed.
The hotfix referenced here is not the solution. The website works, the hotfix appears to be only for Server 2008 (not R2), and when you try to install it, it says "not applicable for this server".
We did discover by running $PSVersionTable that PowerShell was referencing version 2.0 of the CLR. We installed Powershell 3.0 and now Powershell is referencing version 4.0 of the CLR but the problem persists.
We are looking to see if there is a simple solution to this. I suspect we may not have the right version of the IIS management script dll but can't find a different one to use. If the solution gets to complicated, we will just wipe the server and start from scratch.
Thanks for any suggestions,
John

WCF Service strange Exception from Windows 8 Machine

I have a WCF Service that I am consuming in a web-application and I get strange behaviour from my Windows 8 machine:
When I compile the project from Windows 8, I get the following exception when trying to connect to the WCF Service:
The underlying connection was
closed: A connection that was expected to be kept alive was closed by
the server.
I get the same exception when I deploy it onto a Windows Server 2008.
However, if I compiled the project from Windows 7 and deploy it to the server, it works just fine.
I am using Visual Studio 2012 in both cases, although one is Premium and one is Ultimate.
After a lot of testing, it seems like when I just build and deploy the project often enough, at some point it will work, without having changed anything. It seems like the chance of getting a working project is about one in five. The Service works consistently, then, though.
If any of you have an idea what could be going on, that would be nice. If you need more info let me know.

WCF Server Application Unavailable - how to run application written in .NET4.0 (IIS6+)

I am trying to run simple application (e.g. generated from template by VS.NET 2010) on IIS6.
I changed it to run with .NET 4.0 (its application pool) and checked with regiis (this pool has 4.0). I also changed all possible httpHandlers (svc etc), to run with NET4.0. All possible rights are checked (i think so).
Almost every request results in "Server Application Unavailable" (sometimes it is empty page with -2146232576 (0x80131700) value) and "...Please review this log entry to discover what caused this error to occur." but EventViewer and IIS Log are empty.
Any ideas? Where to find error details?
Do you run any 2.0 apps on the same server? If yes it could be the issue in case they bot use the same application pool. The application tool itself doesn't have any .NET version setting, it's per virtual directory (application). But you can't use the same application pool to run applications with different versions of .NET Framework apps.
Create two seperate app pools one for your CLR 2.0 and CLR 4.0, the older clr can not host both CLRs, there was a similar issue with 1.1 and 2.0.
cheers
A little bit old question, but still could help someone...
If you installed the higher .NET f/w recently, check, if your apps written for lower versions of .NET f/w were not (automatically) moved to new app pool for the higher f/w.
Many years ago something similar happenned to me after f/w 3.5 installation. Then my 3.5 application worked fine, but after any of the 2.0 apps was firstly called, the app pool crashed.
Needed to move every app to corresponding app pool.

NHibernate, WCF & SqlServerCE - Exception thrown loading driver

Background
I have a BLL DLL that uses NHibernate. I share the same BLL between a client application and the WCF service (even though the client runs on another machine).
I can successfully use either SqlServerCe or SqlServer driver with the BLL with the client application but can only use the SqlServer driver for the WCF.
If I change the hibernate.cfg.xml to use SQL Server I am able to use the service as required with no exceptions being thrown.
The Error
The exact error from the log4net output is:
2421, 5, DEBUG, NHibernate.Connection.DriverConnectionProvider, (null),Obtaining IDbConnection from Driver
2483, 5, DEBUG, NHibernate.Connection.DriverConnectionProvider, (null),Exception thrown obtaining connection: Exception has been thrown by the target of an invocation.
I also have the following code in my WCF code behind file:
AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
NOTES
WCF bin directory contains all required DLL's for NHibernate and SqlServerCe
Does not matter if System.Data.SqlServerCe.dll is in the GAC
Does not matter if System.Data.SqlServerCe.dll is added to the web.config file under assemblies
Operating Systems is Windows Server 2003 R2 SP2
.NET Framework 3.5SP1 installed
Visual Studio 2008 installed
Just incase, I uninstalled anything to do with compact edition but this still did not resolve the issue
The Question
How would you try and determine why NHibernate cannot load the SqlServerCe framework?
What forensic analysis would you perform to try and accurately determine the problem so that you can then find ways of resolving it?
Update 1
Incase it was my code I just created a simple website and am able to successfully use the ORM to insert and retrieve records using a hard-coded path to the SDF database. If I use the same hibernate configuration file for the webservice then exception is generated. This does narrow down the problem to the WCF implementation.
Well, clearing the ASP.NET temp cache did not do anything and deleting and republishing my site did nothing, but reverting to an VM Snapshot on the Windows 2003 R2 SP2 O/S did!
An update or myself must have done something to the OS that caused the problems.
I have a different problem now as the SQL is not successfully running under the environment but at least the NHibernate driver is loading and running to which this question was asking.
Update: Yes, I can only get NHibernate talking to SQL Server still and this is fine for the webservice endpoint. We will investigate the issues at a later stage. Marking this answer as the correct one as no other comments have been added.