I’m having a problem with an ASP.Net MVC3 application I’ve written. The application consists of basically two assemblies, an MVC3 application for the UI, and an Infrastructure DLL containing the business logic.
The Infrastructure assembly also references a few assemblies provided by a software vendor, which I believe are Interop assembies wrapping the functionality of some COM components provided by the same vendor. The Infrastructure asembly makes a number of calls into the Interop assemblies to perform various functions of my application.
When I run the MVC app in Visual Studio on my development machine (Win7) it works perfectly. Then I deploy the application to the intended web server (IIS 6 on Win2k3R2)and it starts up okay, and most of the functionality works. One of the calls into the Vendor’s assemblies fails, however, with the following cryptic exception:
System.Runtime.InteropServices.COMException: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
at SmarTeam.Std.Interop.SmarTeam.SmApplic.ISmObject.InsertEx2(ISmBehavior Behavior)
at Baa.Smarteam.SecurityManager.Infrastructure.Smarteam.SmarteamAccountRepository.Create(UserAccountFromST smarteamAccount)
--- End of inner exception stack trace ---
at Baa.Smarteam.SecurityManager.Infrastructure.Smarteam.SmarteamAccountRepository.Create(UserAccountFromST smarteamAccount)
at Baa.Smarteam.SecurityManager.Infrastructure.UserAccountRepository.Create(IDualSourceUserAccount userAccount)
at Baa.Smarteam.SecurityManager.Infrastructure.UserManager.CreateUser(Int32 bemsId)
at Baa.Smarteam.SecurityManager.Web.Controllers.UserController.ProcessAction(Nullable`1 id, String actionName, Func`2 action)
The weird thing is that all of the other calls in the Interop assemblies work fine. It’s just this one that fails.
I also delpoyed my MVC application onto the web server in our Test environment for the vendor’s application. The as far as I can tell the OS/IIS/.Net/etc. configurations are the same on both servers. The MVC app works perfectly running on this server.
I’ve tried debugging with Network Monitor and Process Monitor, but nothing obvious shows up.
Today I created a Console Application to exercise the Infrastructure assembly to take ASP.Net out of the equation. The Console app works perfectly on my development machine and also on the target server.
So my question: Apart from the obvious, what are the differences in execution environment between ASP.Net and a Console Application?
One I thought of is the user context. The owner of the logs produced by the MVC app is “Network Service”, but I’m obviously running the console app under my own account. This doesn’t explain the difference in the operation on the two servers, though.
Aside from contacting the vendor (who is usually less than helpful), what else should I be looking at?
This is almost certainly a permission issue.
Your stack trace references classes in the
namespace. As you correctly point out, your MVC app runs as NETWORK SERVICE (by default), while your console app runs under your login account (again, by default).
If things work on a test server, it is because a necessary permission to run the “Baa” code has been granted to NETWORK SERVICE, or because the MVC app is not running as NETWORK SERVICE on that box.
Consider which securable resources the “Baa” app may try to reference (files, registry keys, …) and compare the security settings for those resources on the working server with the settings on the server that is failing.