c# - Simple COM+ server throws unexpected Exception -


i wrote simple servicedcomponent

using system; using system.collections.generic; using system.text; using system.runtime.interopservices; using system.enterpriseservices;  namespace complusserver {     [comvisible(true)]     [classinterface(classinterfacetype.autodual)]     [guid("9c674eca-1b71-42ea-9db2-9a0ea57ec121")]     [description("hello server")]     public class helloserver : servicedcomponent     {         [description("say hello!")]         public string sayhello()         {             return "hello!, ";          }     } } 

and windows forms application

using system.data; using system.drawing; using system.text; using system.windows.forms; using complusserver;  namespace client {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          private void button1_click(object sender, eventargs e)         {             helloserver server = new helloserver();              messagebox.show(server.sayhello(), "message helloserver");         }     } } 

on component services mmc, on application properties, security tab lowered authentication level calls none , impersonation level identify , unchecked enforce access checks application on authorization.

i keep getting servicedcomponentexception exception saying

method-level role based security requires interface definition class method.

any idea on this?

i believe means methods of component class needs defined in interface.

[comvisable(true)] public interface ihelloserver {     public string sayhello();  } 

now have componet class implement interface:

[comvisable(true)] [classinterface(classinterfacetype.autodual)] [comdefaultinterface(typeof(ihelloserver))]      [guid("9c674eca-1b71-42ea-9db2-9a0ea57ec121")]      [description("hello server")]      public class helloserver : servicedcomponent, ihelloserver      {              [description("say hello!")]              public string sayhello()              {                      return "hello!, ";               }      } 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -