ASP.Net and ServicedComponent class not working together? [C#]

dotnet framework

    Next

  • 1. HwndSource.FromHwnd returns null
    Hi, I'm trying to hook up a Wpf Control to a native Win32 window. I have no control over the native win32 parent window. It is passed to me (a plugin) as a HWND (IntPtr). I'm using HwndSource.FromHwnd and pass in the HWND of the parent but null is returned. I tried to create a new instance of HwndSource with the HwndSourceParameters ctor and that sort of worked, but it launched a seperate (parent) window that hosted my Wpf control. I got it to work with WinForms to explicitly use ::SetParent to tie the parent and child control (window) together. -- Grtx Marc Jacobi
  • 2. Dynamically Load/Save Visual Studio Forms
    I want to give my business analysts the ability to create windows forms in Visual Studio 2008. They will not design any code, but just will design the screen and set properties. I will use the Visual Studio sdk to build some other functionality into Visual Studio. I want to be able to save the form that was created and make it more portable, such as sending to somebody else to use. I see that 3 files get created: form1.vb, form1.designer.vb and form1.resx - Is there a way to turn these into xml, or even just use the form1.vb file only? Can I send this to another PC, and then compile the application, and have the whole form, or do I need the designer.vb and rex files also? Could I do a just in time compile and compile the form1.vb form dynamically the first time it is used in the application?
  • 3. Concerning Binary/Project Compatibility
    Hi I was wondering if anyone could explain or perhaps include a link which explains what happens with respect to binary/project compatibility of a dotnet interop project when you build (or rebuild) it. The reason I ask is that I have previously had a dotnet usercontrol (wrapped in the InteropFormsToolkit) working successfully on my development machine. A new version has been issued of this control and I can no longer see it ... so was perhaps wondering if something has changed wrt compatibility. Thx Simon

ASP.Net and ServicedComponent class not working together? [C#]

Postby Jim Bancroft » Sat, 11 Dec 2004 02:42:50 GMT

Hi everyone,

    I have a toy class that inherits from ServicedComponent and a
hand-crafted interface.  It looks like this:

[Transaction(TransactionOption.Supported)]
public class myclass: ServicedComponent, IReadData  //IReadData is the
hand-blown interface
{
    public string GetString()
    {
        return "hello";
    }

    [AutoComplete]
    public string GetData(string strParameters)
        {
            return "goodbye";
        }
    }
}

I've put this into a COM+ package, using regsvcs.exe, and made the package
as "open" as possible-- no security access checks, for instance.  It's
running as a server application under COM+.

Here's the trouble: calling the class's GetData() method in a console app
works fine, but the same call from an ASP.Net page gives an error that says:
"System.InvalidCastException: QueryInterface for interface
Interfaces.IReadData failed."

Here's my definition of the IReadData interface-- it's simple enough:

public interface IReadData
{
    {
        string GetData(string strParameters);
    }
}


Am I doing something wrong here that I can't see?  Are you allowed to
inherit from interfaces at the same time as ServicedComponent, or are there
restrictions regarding this I don't know about?  Or, is there something else
entirely at work?  I'm scratching my head as to why this is happening.

Thanks for any and all help.

-Jim



Similar Threads:

1.ASP.Net doesn't like my ServicedComponent class? [C#]

Hi everyone,

    I have a toy class that inherits from ServicedComponent and a 
hand-crafted interface.  It looks like this:

[Transaction(TransactionOption.Supported)]
public class myclass: ServicedComponent, IReadData  //IReadData is the 
hand-blown interface
{
    public string GetString()
    {
        return "hello";
    }

    [AutoComplete]
    public string GetData(string strParameters)
        {
            return "goodbye";
        }
    }
}

I've put this into a COM+ package, using regsvcs.exe, and made the package 
as "open" as possible-- no security access checks, for instance.  It's 
running as a server application under COM+.

Here's the trouble: calling the class's GetData() method in a console app 
works fine, but the same call from an ASP.Net page gives an error that says: 
"System.InvalidCastException: QueryInterface for interface 
Interfaces.IReadData failed."

Here's my definition of the IReadData interface-- it's simple enough:

public interface IReadData
{
    {
        string GetData(string strParameters);
    }
}


Am I doing something wrong here that I can't see?  Are you allowed to 
inherit from interfaces at the same time as ServicedComponent, or are there 
restrictions regarding this I don't know about?  Or, is there something else 
entirely at work?  I'm scratching my head as to why this is happening.

Thanks for any and all help.

-Jim


2.ASP:Button OnClientClick and Server Side Not working together

Hi,

I have a asp:button which allows a user to delete a record, and I wish to 
prompt them with a client side confirmation.  The javascript confirm 
messagebox does show and the cancel button is fine, however when I click OK, 
I expect the Server Side Postback OnClick event to fire, but it does not.  
Any Ideas?

Here is the code:

<asp:Button ID="BDelete" runat="server" CssClass="buttonRed" Text="Delete" 
Width="80px" OnClick="BDelete_Click" UseSubmitBehavior="False" 
Visible="False" OnClientClick="return confirm('Delete Work Order?');" />


3.ServicedComponent collection class w/ servicedcomponent value obje

I'm having trouble with the following combination.  Ordinarily I would not 
code something like this, but unfortunately I have to rewrite an existing COM 
business app in .NET and client code must be compatible.  So anyway, here is 
the issue:

I have a collection class that inherits servicedcomponent and implements 
IEnumerable.

I can add any object that doesn't inherit servicedcomponent to this 
collection class and I can enumerate it in .NET and COM.  

Unfortunately I need to be able to add a value object that inherits 
servicedcomponent to this collection class.  Via .NET everything works fine, 
I can add objects and enumerate the collection.  Via COM I can add the 
object, and I can iterate the collection by its index, but if I try to 
enumerate via For Each I get "Object required.".  

Has anyone run into this or have any words of wisdom?  I can post sample 
code if that would help, but the code is pretty straight forward.  The 
collection class is simply wrapping an ArrayList and returning the ArrayLists 
enumerator within the GetEnumerator.  I have also tried implementing a custom 
enumerator, to no avail.  I also tried getting an object array from the 
arraylist and returning its enumerator.  

Any clues?

4.Access and ASP.NET working together - any advice?

I am using Access to run a database within the company and also have a
website that makes some of the information available to the general public

And so far everything is working very well

q. is there any problem using Access to do all our internal work while the
DB is exposed to the web

q. if I move to SQL  server can I still use all the features of Access (VBA
reporting etc) for our internal work

I really like Access and would hate to have to do everything through ASP.NET
if I don't have to

I think I just need a little advise before I get stuck into the development
work

Any feedback will be much appreciated
Phil

PS I may have double posted this! 


5.VB.Net 2003 and VS 2005 not working together

Does anyone know when building a msi file under VB.Net 2003, it would try to
install something from the VS 2005 Beta 1?  I have both products installed.

Thanks,


6. Interop class works from winforms but not asp.net

7. named pipes connection string working fine in .net EXE, but NOT working from asp.net

8. ServicedComponent.DisposeObject(this) not working as expected



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 30 guest