Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 22nd, 2004, 12:18 PM
Registered User
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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




 
Old January 22nd, 2004, 01:17 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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).
 
Old January 23rd, 2004, 07:24 AM
Registered User
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old October 14th, 2004, 08:45 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old December 23rd, 2005, 02:03 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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



 
Old June 8th, 2006, 02:32 AM
Registered User
 
Join Date: Jun 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
System.InvalidCastException; System.Reflection.Tar Jophie BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 16th, 2008 03:29 PM
System.InvalidCastException: Specified cast is not scslarry BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 January 18th, 2007 07:34 PM
PhileIdentity - System.InvalidCastException terencetham BOOK: ASP.NET Website Programming Problem-Design-Solution 6 September 25th, 2006 02:27 PM
System.InvalidCastException QueryInterface Error MTCVS .NET Web Services 1 November 30th, 2005 01:21 PM
System.InvalidCastException: Specified cast is not chiefg BOOK: ASP.NET Website Programming Problem-Design-Solution 2 March 2nd, 2004 01:29 PM





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