Click here to Skip to main content
15,891,645 members
Home / Discussions / C#
   

C#

 
GeneralAnimation Pin
hxxbin2-Mar-04 6:55
hxxbin2-Mar-04 6:55 
GeneralRe: Animation Pin
Heath Stewart2-Mar-04 9:13
protectorHeath Stewart2-Mar-04 9:13 
GeneralRe: Animation Pin
hxxbin3-Mar-04 4:03
hxxbin3-Mar-04 4:03 
GeneralRe: Animation Pin
Heath Stewart3-Mar-04 5:55
protectorHeath Stewart3-Mar-04 5:55 
GeneralEnterprise Services: InvalidCastException when calling a method Pin
Le centriste2-Mar-04 5:45
Le centriste2-Mar-04 5:45 
GeneralRe: Enterprise Services: InvalidCastException when calling a method Pin
Heath Stewart2-Mar-04 6:55
protectorHeath Stewart2-Mar-04 6:55 
GeneralRe: Enterprise Services: InvalidCastException when calling a method Pin
Le centriste2-Mar-04 8:05
Le centriste2-Mar-04 8:05 
GeneralRe: Enterprise Services: InvalidCastException when calling a method Pin
Le centriste2-Mar-04 8:40
Le centriste2-Mar-04 8:40 
I have more information, now I have a message instead of the question mark:

System.InvalidCastException: QueryInterface for interface MyApplication.IMyInterface failed

Here is how the Serviced component object is declared:

namespace MyApplication
{
	[SecurityRole("MyAppClients")]
	public interface IMyInterface
	{
		string MyMethod(string s1, string s2);
	}

	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	[ConstructionEnabled(true, Default="Server=(local);trusted connection=yes")]
	[Transaction(TransactionOption.Supported)]
	[ComponentAccessControl(true)]
	[SecurityRole("MyAppClients")]
	//[SecureMethod]
	public class MyClass: ServicedComponent, IMyInterface
	{
		private string connectionString = String.Empty;

		public MyClass()
		{
			//
			// TODO: Add constructor logic here
			//
		}
	
		protected override void Construct(string s)
		{
			this.connectionString = s;

			base.Construct(s);
		}
	
		#region IMyInterfaceimplementation

		public string MyMethod(string s1, string s2)
		{
			// TODO:  Add DataAccess.GetLogonToken implementation
			return "My String";
		}

		#endregion
	}


When the application is registered in COM+, I add the MYMACHINE\ASPNET user to the role.

Here is how it is called from the Asp.NET client:

IMyInterface myInterface = new MyClass();

string aString = myInterface.MyMethod("s1", "s2"));


The exception is thrown at the second line.

--------

"I say no to drugs, but they don't listen."
- Marilyn Manson
GeneralRe: Enterprise Services: InvalidCastException when calling a method Pin
Heath Stewart2-Mar-04 8:57
protectorHeath Stewart2-Mar-04 8:57 
GeneralRe: Enterprise Services: InvalidCastException when calling a method Pin
Nick Parker2-Mar-04 9:14
protectorNick Parker2-Mar-04 9:14 
GeneralTextBox for number Pin
Amirjalaly2-Mar-04 5:31
Amirjalaly2-Mar-04 5:31 
GeneralRe: TextBox for number Pin
Heath Stewart2-Mar-04 6:52
protectorHeath Stewart2-Mar-04 6:52 
GeneralRe: TextBox for number Pin
Werdna3-Mar-04 5:18
Werdna3-Mar-04 5:18 
GeneralRe: TextBox for number Pin
Heath Stewart3-Mar-04 5:58
protectorHeath Stewart3-Mar-04 5:58 
GeneralRe: TextBox for number Pin
Stefan Troschuetz3-Mar-04 8:29
Stefan Troschuetz3-Mar-04 8:29 
GeneralRe: TextBox for number Pin
indranilbanerjee31-Mar-04 4:45
indranilbanerjee31-Mar-04 4:45 
GeneralRe: TextBox for number Pin
Stefan Troschuetz31-Mar-04 5:20
Stefan Troschuetz31-Mar-04 5:20 
GeneralRe: TextBox for number Pin
indranilbanerjee31-Mar-04 22:02
indranilbanerjee31-Mar-04 22:02 
Questionhow to assigning a Drive to a Share ? Pin
zoltix2-Mar-04 5:22
zoltix2-Mar-04 5:22 
AnswerRe: how to assigning a Drive to a Share ? Pin
Heath Stewart2-Mar-04 6:47
protectorHeath Stewart2-Mar-04 6:47 
GeneralRe: how to assigning a Drive to a Share ? Pin
zoltix2-Mar-04 12:44
zoltix2-Mar-04 12:44 
GeneralRe: how to assigning a Drive to a Share ? Pin
Dave Kreskowiak2-Mar-04 13:25
mveDave Kreskowiak2-Mar-04 13:25 
GeneralRe: how to assigning a Drive to a Share ? Pin
zoltix2-Mar-04 21:41
zoltix2-Mar-04 21:41 
Generalc# in remote access and control Pin
keenweng2-Mar-04 4:59
keenweng2-Mar-04 4:59 
GeneralRe: c# in remote access and control Pin
Dave Kreskowiak2-Mar-04 5:57
mveDave Kreskowiak2-Mar-04 5:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.