Solved

System.Runtime.InteropServices.COMException: Server request failed --> works in debug, but not from IIS

Posted on 2008-09-30
7
1,169 Views
Last Modified: 2012-06-27
I am in the first stages of development/testing of a C# web-based app that uses third-part COM based files that make calls to the third-party server.

Test Environment includes:
XP Pro SP3
Visual Web Developer 2008

When run in debug, calls can be successfully sent/received to the third-party server via the browser.  If the same page is referenced in IIS (from the same dev box) outside of the debug environment, the following error occurs when the app attempts to connect to the 3rd party server:

System.Runtime.InteropServices.COMException: Server request failed

The stack trace info includes:
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

I've tried registering the assembly, etc., without success.
0
Comment
Question by:jsoderquist
  • 4
  • 2
7 Comments
 
LVL 5

Assisted Solution

by:johnaryan
johnaryan earned 125 total points
ID: 22609222
Could it be a permissions error? You may have to set a machine.config setting to allow the IUSER_machinename service account to use interop!

As a test, i would change the IIS user to your own username, and if it works then, you should go about adding the neccessary permissions to the IUSER account.
0
 

Author Comment

by:jsoderquist
ID: 22616079
I created a new user account, and then updated web.config to use that account
<identity impersonate="true" userName="ASPUSER" password="xxxx" />

I also added code to display the current user in order to be 100% sure.

The virtual directory that points to the dev folder has full read/write/execute permissions, and Application Protection of Low

With the current user as "ASPUSER", it continues to work fine on the development server, but the same error occurs with IIS.
0
 

Author Comment

by:jsoderquist
ID: 22618819
Further testing indicates the logon/authentication request does actually reach the third-party server under the regular IIS scenario, but fails to logon and create a session.  If a user account, password, etc. is typod the appropriate message is returned from the third party server.  However, when correct authentication info is sent the authentication request fails with the generic message of System.Runtime.InteropServices.COMException (0x80041D8F): Server request failed.

Ive hard-coded the request string for testing.  If the hard-coded authentication request is sent via the development server, it logs in and creates a session.  If sent via the IIS server, it fails.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 5

Expert Comment

by:johnaryan
ID: 22622464
I found this quote on a forum:

"In order to do this, you have to set the ASPCompat flag at the top of
your page to true. This sets the apartment model of the thread that your
page is processed on so that it can run COM objects. Doing this in an
ASP.NET environment incurs a performance penalty though, and should be
avoided." http://bytes.com/forum/thread246333.html

Did you try changing the site to run under the Admin account to verify it's a permissions issue?
0
 

Author Comment

by:jsoderquist
ID: 22625676
The test user ASPUSER is already a member of Administrators.

FYI - the third-party server is Televantage 7.50.4817, and am using the drivers from their SDK.

When aspcompat="true" was added:
1) When tested w/ IIS the authentication request still fails.
2) When started in debug, the page start fails with the following error:

System.AccessViolationException was unhandled by user code
  Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
  Source="TVWebProj2"
  StackTrace:
       at TVWebProj2._Default.Page_Load(Object sender, EventArgs e) in C:\dev\tv\TVWebProj2\TVWebProj2\Default.aspx.vb:line 27
       at System.Web.UI.Control.OnLoad(EventArgs e)
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException:
0
 

Accepted Solution

by:
jsoderquist earned 0 total points
ID: 22672976
Issue was resolved when web app was tested on Win2003 (IIS 6) after some modifications.  App will be set up to run the 2003/IIS6 box (which does the API calls to the TV server).  The web app does web services from/to other apps, essentially acting as middleware, so we should be good for now.
0
 

Expert Comment

by:seju123
ID: 33420448
Can you please help me as I am having the same issue. I am trying to connect televantage server usign their sdk from Visual studio 2008 websit, and getting this error message

System.Runtime.InteropServices.COMException was unhandled by user code
  ErrorCode=-2147213937
  Message="Server request failed"
  Source="TeleVantage.Session(0x7D27460,U2777).Logon_v61"
  StackTrace:
       at TeleVantage.SessionClass.Logon(String Server, String UserName, String Password, Int32 Station, TVApplicationType ApplicationType, Int32 ApplicationID, TVServerConnectionLevel ServerConnectionLevel, Boolean CheckVersions, TVStationUsage StationUsage)    at _Default.btnCall_Click(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\Desktop\WebSite1\Default.aspx.vb:line 17    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)    at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)    at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException:

Thanks.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now