Hi All,
I have a third party COM object done in C++. I want to use this COM object in my asp.net project. I'm able to add reference and initialize the object but when I'm getting a run-time error below:
Server Error in '/aspnet/fsc' Application.
--------------------------------------------------------------------------------
ERROR: Unable to Create an Instance of the Server
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: ERROR: Unable to Create an Instance of the Server
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[UnauthorizedAccessException: ERROR: Unable to Create an Instance of the Server]
STEALTHRATERAPILib.AutoClass.GetMaritalStatus(Int3 2 nAgentID) +0
fsc.auto_profile.Page_Load(Object sender, EventArgs e) in f:\aspnet\fsc\auto_profile.aspx.cs:25
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
The ASP.Net account has been granted the access to the DLL but I'm still getting this error. Is there something else I'm missing when referencing the DLL? Should there be an Interop DLL to be added to the project in order for this to work?
Thanks very much
Henry 2 2316
Hi
All you should need to do is to add the reference - VS.NET creates the interop dll for you, so you're not missing anything here. Below are some pointers that may help you...
The security context (user) that your code is running under is determined by two factors:
1. is anonymous access is enabled for the site/virtual-folder in IIS?
2. is impersonation enabled in web.config?
One way to find out which user needs access to the COM component is to add something like this just before your call:
....
IIdentity i = System.Threading.Thread.CurrentPrincipal.Identity;
System.Diagnostics.Debug.WriteLine(i.Name);
// call COM component
....
Does your COM component use any other files/folders?
If your web application runs with anything other than full trust, you may also run into code access security problems (because the COM component is unmanaged code which requires full trust) - but I think you will get a different exception if that was the case here.
Richard.
"HTM" <hm**@superioraccess.net> wrote in message news:eC*************@TK2MSFTNGP09.phx.gbl...
Hi All,
I have a third party COM object done in C++. I want to use this COM object in my asp.net project. I'm able to add reference and initialize the object but when I'm getting a run-time error below:
Server Error in '/aspnet/fsc' Application.
------------------------------------------------------------------------------
ERROR: Unable to Create an Instance of the Server
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: ERROR: Unable to Create an Instance of the Server
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[UnauthorizedAccessException: ERROR: Unable to Create an Instance of the Server]
STEALTHRATERAPILib.AutoClass.GetMaritalStatus(Int3 2 nAgentID) +0
fsc.auto_profile.Page_Load(Object sender, EventArgs e) in f:\aspnet\fsc\auto_profile.aspx.cs:25
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
The ASP.Net account has been granted the access to the DLL but I'm still getting this error. Is there something else I'm missing when referencing the DLL? Should there be an Interop DLL to be added to the project in order for this to work?
Thanks very much
Henry
Hi
All you should need to do is to add the reference - VS.NET creates the interop dll for you, so you're not missing anything here. Below are some pointers that may help you...
The security context (user) that your code is running under is determined by two factors:
1. is anonymous access is enabled for the site/virtual-folder in IIS?
2. is impersonation enabled in web.config?
One way to find out which user needs access to the COM component is to add something like this just before your call:
....
IIdentity i = System.Threading.Thread.CurrentPrincipal.Identity;
System.Diagnostics.Debug.WriteLine(i.Name);
// call COM component
....
Does your COM component use any other files/folders?
If your web application runs with anything other than full trust, you may also run into code access security problems (because the COM component is unmanaged code which requires full trust) - but I think you will get a different exception if that was the case here.
Richard.
"HTM" <hm**@superioraccess.net> wrote in message news:eC*************@TK2MSFTNGP09.phx.gbl...
Hi All,
I have a third party COM object done in C++. I want to use this COM object in my asp.net project. I'm able to add reference and initialize the object but when I'm getting a run-time error below:
Server Error in '/aspnet/fsc' Application.
------------------------------------------------------------------------------
ERROR: Unable to Create an Instance of the Server
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: ERROR: Unable to Create an Instance of the Server
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[UnauthorizedAccessException: ERROR: Unable to Create an Instance of the Server]
STEALTHRATERAPILib.AutoClass.GetMaritalStatus(Int3 2 nAgentID) +0
fsc.auto_profile.Page_Load(Object sender, EventArgs e) in f:\aspnet\fsc\auto_profile.aspx.cs:25
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
The ASP.Net account has been granted the access to the DLL but I'm still getting this error. Is there something else I'm missing when referencing the DLL? Should there be an Interop DLL to be added to the project in order for this to work?
Thanks very much
Henry This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jimmy Tran |
last post by:
Hi Folks,
I have a web database written in asp and using access97. I have many
projects, but each project is being held responsible by a person. All
people and projects come from the database....
|
by: typingcat |
last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so
on. I've tried many PHP IDEs today, but almost non of them supported
Unicode (UTF-8) file.
I've found that the only Unicode...
|
by: Derek Martin |
last post by:
I am creating a windows service and have added a reference to a DLL project
that I have created. That DLL file is correctly referenced in both a
windows app and a web app, all in the same...
|
by: Bill Nguyen |
last post by:
I would like to add a new VB.NET project using the same folder being used by
another project so that I can share several forms already creaded by the
other project. However, .NET created a new...
|
by: Diffident |
last post by:
Hello All,
I have a question as to why my users are noticing error when I am building
the project on the production system. Here is the problem's background.
In order to build the project on...
|
by: Bruce |
last post by:
I am using VB in Vs2005. Am I missing something or does VB not have the
concept of "builds" (release/debug) like in VC? I wrote an assembly
and I would like to have a debug version of the DLL...
|
by: BDowling |
last post by:
Hi all,
I have an existing Visual C++ project that builds a DLL (not COM or
ATL or anything). I wish to use this DLL in a Visual Studio 2005 C#
project without having to define each function and...
|
by: =?Utf-8?B?WW9naSBXYXRjaGVy?= |
last post by:
Hello,
I am using Visual Studio-2003. I created a project to build my library.
Since I am using third party libraries as well, I have specified those
additional library dependencies in project...
|
by: Daniel Kraft |
last post by:
Hi all,
in my C++ projects, I usually make "heavy use" of namespaces to
"encapsulate" my code. When I have for instance something like this:
namespace project
{
namespace part1 { ... }...
|
by: Jeff |
last post by:
I have a solution with two projects. Project A is the startup
project, while Project B serves as the project with the data logic.
At run time, the first thing I need to do is write to Project...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |