Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 22nd, 2004, 12:18 PM
Registered User
 
Join Date: Jan 2004
Location: banl, kan, India.
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




Reply With Quote
  #2 (permalink)  
Old January 22nd, 2004, 01:17 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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).
Reply With Quote
  #3 (permalink)  
Old January 23rd, 2004, 07:24 AM
Registered User
 
Join Date: Jan 2004
Location: banl, kan, India.
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.

Reply With Quote
  #4 (permalink)  
Old October 14th, 2004, 08:45 AM
Registered User
 
Join Date: Oct 2004
Location: , , .
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.

Reply With Quote
  #5 (permalink)  
Old December 23rd, 2005, 02:03 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
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



Reply With Quote
  #6 (permalink)  
Old June 8th, 2006, 02:32 AM
Registered User
 
Join Date: Jun 2006
Location: Cairo, Cairo, Egypt.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



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


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