Re: q: QueryInterface failed ?
From: Guy Anthuenis (Guy.Anthuenis_at_pandora.be)
Date: 05/09/03
- Previous message: Sitaraman: "Re: AuthenticateRequest Event Not Firing"
- In reply to: Yury Zenkevich: "q: QueryInterface failed ?"
- Next in thread: Yury Zenkevich: "Re: q: QueryInterface failed ?"
- Reply: Yury Zenkevich: "Re: q: QueryInterface failed ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 08 May 2003 23:20:13 GMT
Hi,
I am experiencing the same problem right now. I have a Serviced Component that is managing my Shared Properties. Initializing and refreshing SPM starting from a Windows Application is not a problem,
but doing exactly the same from an ASP.NET application causes QueryInterface error messages.
The problem here is the identity of the caller. There has to happen some impersonation of the client's identity, something that happens inside COM+ itself. ASP.NET doesn't impersonate by default,
meaning COM+ won't be aware of any identity. You can solve this by adding the line:
<identity impersonate="true" />
to the web.config file just as a child of the <system> element. Use Windows Authentication on IIS on your virtual directory, and your problem will be partially solved. Partially, because this works
fine when running all on the same machine. When a remote client connects to your web app, he will still have this problem.
I guess that you have to call CoImpersonateClient() in your Serviced Component, but I'm not sure of that yet.
If you already have found the solution, please post it here, or mail it to me, it would save me time as well.
This error message you are receiving doesn't mean anything actually. What is happening is some kind of security check. And that is the real problem here. Impersonation solves this problem.
Guy
On Thu, 8 May 2003 12:11:47 +0300, "Yury Zenkevich" <yury@altiris.ee> wrote:
>Hi All !
>
>Got some problem, which appears not allways, but sometimes after
>compilation/reinstall or some other sequence which ruins it all.
>Here is an idea: I wrote my own COM+ component to have access to some
>external data from my asp.net application. And here is the problem I've got
>after trying to get some property from IStream interface:
>
>
> QueryInterface for interface YZComPlusLibrary.IStream failed.
>[System.InvalidCastException]
>
>--------------------------------------------------------------------------
>
> Server stack trace:
> at YZComPlusLibrary.IStream.get_Length()
> at
>System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(Met
>hodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean
>fExecuteInContext, Object[]& outArgs)
> at
>System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessa
>ge msg, Int32 methodPtr, Boolean fExecuteInContext)
>
> Exception rethrown at [0]:
> at
>System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
>reqMsg, IMessage retMsg)
> at
>System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
>msgData, Int32 type)
> at YZComPlusLibrary.ExternalFile.get_Length()
> at YZLib.NET.TaskPage.DownloadFile(String sPathName, String
>sContentType) in c:\inetpub\wwwroot\yzlib.net\task.aspx.cs:line 733
> at YZLib.NET.TaskPage.doDownload() in
>c:\inetpub\wwwroot\yzlib.net\task.aspx.cs:line 823
> at YZLib.NET.TaskPage.Page_Load(Object sender, EventArgs e) in
>c:\inetpub\wwwroot\yzlib.net\task.aspx.cs:line 141
>
>
>
>What is wrong here ?! The source code for that object is VERY simple:
>
>public interface IStream
>{
> long Length { get; }
>}
>
>public class ExternalFile : ServicedComponent, IStream
>{
> // some initialization code here
>...
> FileInfo oInfo;
>
> // implementation of IStream
> public Length { get { return oInfo.Length; } }
>}
>
>
>Thank you,
>
>Yury.
>
- Previous message: Sitaraman: "Re: AuthenticateRequest Event Not Firing"
- In reply to: Yury Zenkevich: "q: QueryInterface failed ?"
- Next in thread: Yury Zenkevich: "Re: q: QueryInterface failed ?"
- Reply: Yury Zenkevich: "Re: q: QueryInterface failed ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|