简体   繁体   English

ASP.Net和控制台之间的执行差异

[英]Execution differences between ASP.Net and Console

I'm having a problem with an ASP.Net MVC3 application I've written. 我编写的ASP.Net MVC3应用程序有问题。 The application consists of basically two assemblies, an MVC3 application for the UI, and an Infrastructure DLL containing the business logic. 该应用程序基本上由两个程序集,一个用于UI的MVC3应用程序以及一个包含业务逻辑的基础结构DLL组成。

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. 基础结构程序集还引用了软件供应商提供的一些程序集,我认为它们是封装了同一供应商提供的某些COM组件功能的Interop组件。 The Infrastructure asembly makes a number of calls into the Interop assemblies to perform various functions of my application. 基础结构程序集对Interop程序集进行了许多调用,以执行我的应用程序的各种功能。

When I run the MVC app in Visual Studio on my development machine (Win7) it works perfectly. 当我在开发计算机(Win7)上的Visual Studio中运行MVC应用程序时,它可以完美运行。 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. 然后,我将应用程序部署到预期的Web服务器(Win2k3R2上的IIS 6),它可以正常启动,并且大多数功能都可以运行。 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. 奇怪的是,Interop程序集中的所有其他调用都能正常工作。 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. 我还在供应商的应用程序的测试环境中将MVC应用程序部署到Web服务器上。 The as far as I can tell the OS/IIS/.Net/etc. 据我所知OS / IIS / .Net / etc。 configurations are the same on both servers. 两台服务器上的配置相同。 The MVC app works perfectly running on this server. MVC应用程序可以在此服务器上完美运行。

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. 今天,我创建了一个控制台应用程序,以练习基础结构程序集以使ASP.Net脱颖而出。 The Console app works perfectly on my development machine and also on the target server. Console应用程序可以在我的开发计算机上以及目标服务器上完美运行。

So my question: Apart from the obvious, what are the differences in execution environment between ASP.Net and a Console Application? 所以我的问题是:除了显而易见的以外,ASP.Net和控制台应用程序在执行环境上有什么区别?

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. 由MVC应用程序生成的日志的所有者是“网络服务”,但显然我正在使用自己的帐户运行控制台应用程序。 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 您的堆栈跟踪引用了

Baa.Smarteam.SecurityManager

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). 如您正确指出的那样,您的MVC应用程序以网络服务(默认情况下)运行,而控制台应用程序以登录帐户(同样,默认情况下)运行。

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. 如果在测试服务器上一切正常,那是因为已向NETWORK SERVICE授予了运行“ Baa”代码的必要权限,或者是因为该框中的MVC应用程序作为NETWORK SERVICE运行。

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. 考虑“ Baa”应用程序可能尝试引用哪些安全资源(文件,注册表项等),并将工作服务器上那些资源的安全设置与发生故障的服务器上的设置进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.NET和Java Servlets / JSP之间的技术差异 - Technical differences between ASP.NET and Java Servlets / JSP ASP.NET MVC中的缓存和会话之间的访问差异 - Access differences between cache and session in ASP.NET MVC ASP.NET Core 中的 ConfigureServices() 和 Configure() 有什么区别? - What are the differences between ConfigureServices() and Configure() in ASP.NET Core? ASP.net Core中主机和服务器的区别和关系 - Differences and relation between host and server in ASP.net Core Async 和 await - 控制台、Windows 窗体和 ASP.NET 之间的区别 - Async and await - difference between console, Windows Forms and ASP.NET SignalR在ASP.NET和控制台应用程序之间通信 - SignalR Communicate between asp.net and Console Application asp.net 内核中的控制台应用程序和 Web 应用程序之间的区别 - Difference between a console application and Web application in asp.net core Console App和Windows Service在代码执行方面有什么区别 - What are the differences in code execution between Console App and Windows Service 如何在ASP.NET MVC 5应用程序和.NET控制台应用程序之间共享数据库? - How to share a database between ASP.NET MVC 5 application and .NET console application? 在ASP.NET中自动执行代码 - Automatic code execution in ASP.NET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM