p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   .NET Web Services (http://p2p.wrox.com/forumdisplay.php?f=102)
-   -   System.InvalidCastException: QueryInterface for (http://p2p.wrox.com/showthread.php?t=8461)

sweta January 22nd, 2004 12:18 PM

System.InvalidCastException: QueryInterface for
 
Hi,
I have a problem in web service, I have created the dll in vb, which i am referencing it in my web service, It gives me this error:
-------------------------
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidCastException: QueryInterface for interface SykesEKMS._CUsers failed. at SykesEKMS.CUsersClass.ListByLogin(String& UserREF, String& LoginString, Int16& RoleFilter) at eKMSWS.eKMS.cUsers_ListByLogin(String strUserID, String strUsername, String strFirstName, String strLastName, String strEmailAddress) in C:\Inetpub\wwwroot\eKMSWS\eKMS.asmx.vb:line 200 --- End of inner exception stack trace ---
--------------------------
The same dll when i used it in another VB project just for the sake of testing , it works fine.
Why is that the same dll in web service doesn't work?

Please help me ...
Sweta





planoie January 22nd, 2004 01:17 PM

It looks like this is an issue with datatypes. You might need to do some explicit conversions of the data from/to the COM object(s).

sweta January 23rd, 2004 07:24 AM

Hi,
I found the answer to the problem.
I tried th option 2, by just specifying
<identity impersonate="true"/>
 in the web.config file.
And working absoultely fine.


It is properly related with security. The ASPNET account needs to have
sufficient permission to execute the DLL and any other DLLs that it
requires. If it has permissions, then try the following steps:

1. Check whether legacy COM Component References ASP.tlb and tries to use
Response/Request objects.
In this case set the <%@Page AspCompat="true"%> Attribute in the ASP.NET
WebForm

2. Check whether WebService or WebForm calls remote COM+ Component.
Auditing Logon/Logoff Failures will show ASPNET failing to logon to the
Remote COM+ Server. In this case set the following Tag in Web.Config file

<identity impersonate="true" userName="uid" password="pwd"/>

NOTE, if using Integrated security just setting Impersonate to true should
workfine. If using Anonymous, then can change the Anonymous user in IIS to
a domain account, and only set impersonate="true". This may be needed if
you do not want to specify a user and password in the web.config file.

Thank All,
Sweta.


amsouth_jeffreygale October 14th, 2004 08:45 AM

Thanks you so much for solving my problem - I've searched and searched on the web and waded through post after post of IMarshal this and Regsvcs that, only to find that the solution was as simple as the web.config entry you provided.

Here's my question: what are the implications of adding the impersonate appSetting? Am I trading off anything - performance or security, for instance?


Thanks again!!!

Quote:

quote:Originally posted by sweta
 Hi,
I found the answer to the problem.
I tried th option 2, by just specifying
<identity impersonate="true"/>
in the web.config file.
And working absoultely fine.


It is properly related with security. The ASPNET account needs to have
sufficient permission to execute the DLL and any other DLLs that it
requires. If it has permissions, then try the following steps:

1. Check whether legacy COM Component References ASP.tlb and tries to use
Response/Request objects.
In this case set the <%@Page AspCompat="true"%> Attribute in the ASP.NET
WebForm

2. Check whether WebService or WebForm calls remote COM+ Component.
Auditing Logon/Logoff Failures will show ASPNET failing to logon to the
Remote COM+ Server. In this case set the following Tag in Web.Config file

<identity impersonate="true" userName="uid" password="pwd"/>

NOTE, if using Integrated security just setting Impersonate to true should
workfine. If using Anonymous, then can change the Anonymous user in IIS to
a domain account, and only set impersonate="true". This may be needed if
you do not want to specify a user and password in the web.config file.

Thank All,
Sweta.



c4_mak_18@yahoo.com December 23rd, 2005 02:03 AM

Ihave a similar problem as I have a component in VB 6.0 which i used in my web service (at local host), it works fine. But when I deployed this web service on the server, the following error occured.

System.Web.Services.Protocols.SoapException: Server was unable to process request. QueryInterface for interface XXXXX failed.
where XXXXX is my component name.

I have already register the dll and also give full rights to the folder where my project resides. but still it gives the same error. Please resolve my problem ASAP. Thanks




Ahmed_cseng June 8th, 2006 02:32 AM

I read this forum and i had experience from ur posts
I solved this problem by
1. The security issues u posted here
2. I converted the dll i created with VS6 to ATL and used it as it is in my ASP.net web server

I hope this may help u

Thanks

Eng Ahmed Abu El Ella
Ahmed_cseng@yahoo.com
Software Developer


All times are GMT -4. The time now is 09:38 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.