Re: [ADVANCED-DOTNET] COM+ Instance Count Does Not Decrease When Called from .NET Application
Do you have Just In Time Activation enabled? If not, do you Dispose() from the client? -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:ADVANCED- [EMAIL PROTECTED] On Behalf Of Ken Benoit Sent: Monday, November 01, 2004 8:59 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] COM+ Instance Count Does Not Decrease When Called from .NET Application I have a VB.NET Serviced Component running in COM+ that creates a PowerPoint Application object, several slides and then saves the Presentation to disk. From within the same VB.NET serviced component I then open the saved Presentation to a FileStream object and read the contents with a BinaryReader into a Byte array to be shipped over the wire (function result Public Function GetPPTPresentation() As Byte() Implements IRemotePowerPoint.GetPPTPresentation). I then exported the COM+ package as an application proxy to be installed on a separate server. I can get the calling server to call into the .NET Serviced component and receive the Presentation no problem. I can even get PowerPoint to shutdown but the problem I am having is that the COM+ Instance Count Does Not Decrease When Called from .NET Application. FYI it is an ASP.NET (VB.NET code behind) client calling a VB.NET serviced component. Can provide the code if necessary! === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with C# November 29 - December 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with C# November 29 - December 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] Aborting long-running remote calls
Threads in the thread pool are the thread pool's not yours and therefore it's an evil act to kill them. You also might want to think about the security implications of what you are planning to do there. Since Remoting is insecure, everyone can essentially kill everyone's threads by just guessing numbers. I would think that it is not too unlikely that the client has a rough idea how patient it wants to be from the get-go. I would consider sending a timeout value as a parameter of the original call. That way, you are more flexible in how you deal with that timeout. You could spin your own threads and kill them (not so elegant, but ok depending on use-case) or if you are waiting for external resources, you could instruct the underlying resource provider (whatever you use) to cancel operations after a certain time has elapsed (much better). A blank check for a remote kill thread command is nothing I would issue to any client. -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:ADVANCED- [EMAIL PROTECTED] On Behalf Of Diranieh, Yazan Sent: Tuesday, September 07, 2004 5:16 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Aborting long-running remote calls I have a client app that remotely calls a server-side component using .NET Remoting - the server-side DLLs run in a listener implemented as a Window Service. I want to give the user on the client-side the ability to cancel long- running and potentially expensive calls. How can I cancel such calls? One approach I can think of is: 1) Let the client call the server asynchronously. 2) Because .NET Remoting is used, the remote call will run on a thread from the thread pool. Get the ID of this thread and return to client. 3) Now if client wants to cancel the long-running call, the client can call a special server-side method to abort a thread with the given ID. Any comments on this approach? Other approaches? Regards Yazan.Diranieh - 0 error(s), 0 warning(s) == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. == === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] Emitting an attribute on a method's return parameter
Because you are using the attribute for a different purpose than it was designed for, you should define your own attribute class have the reflection code evaluate that (maybe in addition to the XmlElementAttribute ... || is a very easy operator to use) -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:ADVANCED- [EMAIL PROTECTED] On Behalf Of Mark Bugeja Sent: Monday, September 06, 2004 8:28 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Emitting an attribute on a method's return parameter I've been asked to assist with a project where they're dynamically emitting web service assemblies around some existing code. The XmlElementAttribute needs to be applied to webmethod return parameter for everything to work correctly. - Original Message - From: Thomas Tomiczek [EMAIL PROTECTED] Date: Monday, September 6, 2004 3:05 pm Subject: Re: [ADVANCED-DOTNET] Emitting an attribute on a method's return parameter What good would this be, given that methods are not evaluated by the XmlSerializer? Thomas Tomiczek THONA Software Consulting Ltd. (Microsoft MVP C#/.NET) (CTO PowerNodes Ltd.) -Original Message- From: Unmoderated discussion of advanced .NET topics. [EMAIL PROTECTED] On Behalf Of Mark Bugeja Sent: Montag, 6. September 2004 04:08 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Emitting an attribute on a method's return parameter Guys, I need to emit an XmlElementAttribute on the return parameter of a method. Googling seems to indicate that there is a bug in the framework preventing retrieval of the return parameter using the MethodBuilder.DefineParameter() and that the workaround is to emit the attribute directly on the method. In my instance this does not work because XmlElementAttribute is only allowed on properties and parameters and is therefore ignored by the serializers. Does anyone know of a way to get an attribute onto the return parameter using Reflect/Emit? Thanks, Mark Bugeja === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] How do I make a call back to the client from a webservice?
The server has to keep the HTTP connection open in order to be able to send a response back when the service implementation finishes. What if that takes 2 days, because the service is don't return until the next relevant event occurs and that doesn't happen for 2 days? Well, I think nothing wrong will happen but in reality both client and server need to specify a reasonable timeout (unless some TCP-level mechanisms to check whether the connection is still active, e.g., the server is still available, are used). That's not how HTTP works ;) -cv === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server
It's a puzzle to me what sort of mental state would trigger anyone being so arrogant (and insulting) just because someone else has a bit of a misconception about how things work and is therefore asking for help. I can think of a few terms I usually associate with folks having such an attitude, but I think I will rather skip the enumeration given that this is a public forum. -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Tomiczek Sent: Monday, July 26, 2004 3:30 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server Ok, let's go. -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Jon Stonecash Sent: Montag, 26. Juli 2004 14:13 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server I am having a problem getting SQL Server and .NET to agree on the sort order for some data. Really? My sort column in SQL Server is character data ([varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS). As I understand this, the data sorts in dictionary order. Thus, a value of F-SA sorts between FR and FT. Tip: you seem to haves kipped reading the beginner section of your SQL documentation. Your understanding is totally unsubstantiated. The problem is that .NET seems to think that the data is not in order. I And guess what, .NET is right with this. Beginner SQL: unless you explicitly sort the data, it is unsorted in the returned data set. have tried all of the CultureInfo settings that I can think of to convince .NET to see this as ordered. I have a need to Why not fix your bugs regarding any basick nowledge how SQL works, instead of trying to get .NET agreeing? process these rows and compare them to another sorted stream of data and the comparison is going nuts when it gets to these special cases. Then why do you not sort the data? Is there a way to get SQL Server and .NET on the same (code) page without sorting the data internally after reading it from SQL Server? No. SQL 101. Unless the SQL statement specifies a sort order, sort order is random. That said - why do you not just specify a sort order in your query? This is pretty simple, and you do not have to resort on the client then. It just is not automatic. Note: SQL is SET ORIENTED. Sets do not have an intrinsic sort order. Thomas Tomiczek THONA Software Consulting Ltd. (Microsoft MVP C#/.NET) (CTO PowerNodes Ltd.) Jon Stonecash === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server
Thank you for brilliantly supporting my point. -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Tomiczek Sent: Monday, July 26, 2004 4:05 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server And in return I will refrain from telling you loudly what I think of people making posts such as yours. Very nicely, clemens. One of the most arrogant posts I read in the last weeks here. I was not insulting at all. All I did point oout is that someone had not done his homework (but came to an advanced forum) based on what turned out to be a total bad decsription of the error. What terms you associate with this I do not know. I consider incompetence not acceptable. Maybe in your ocmpany it IS acceptable. Your decision. That simple. Thomas -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Clemens F. Vasters Sent: Montag, 26. Juli 2004 16:00 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server It's a puzzle to me what sort of mental state would trigger anyone being so arrogant (and insulting) just because someone else has a bit of a misconception about how things work and is therefore asking for help. I can think of a few terms I usually associate with folks having such an attitude, but I think I will rather skip the enumeration given that this is a public forum. -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Tomiczek Sent: Monday, July 26, 2004 3:30 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server Ok, let's go. -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Jon Stonecash Sent: Montag, 26. Juli 2004 14:13 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server I am having a problem getting SQL Server and .NET to agree on the sort order for some data. Really? My sort column in SQL Server is character data ([varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS). As I understand this, the data sorts in dictionary order. Thus, a value of F-SA sorts between FR and FT. Tip: you seem to haves kipped reading the beginner section of your SQL documentation. Your understanding is totally unsubstantiated. The problem is that .NET seems to think that the data is not in order. I And guess what, .NET is right with this. Beginner SQL: unless you explicitly sort the data, it is unsorted in the returned data set. have tried all of the CultureInfo settings that I can think of to convince .NET to see this as ordered. I have a need to Why not fix your bugs regarding any basick nowledge how SQL works, instead of trying to get .NET agreeing? process these rows and compare them to another sorted stream of data and the comparison is going nuts when it gets to these special cases. Then why do you not sort the data? Is there a way to get SQL Server and .NET on the same (code) page without sorting the data internally after reading it from SQL Server? No. SQL 101. Unless the SQL statement specifies a sort order, sort order is random. That said - why do you not just specify a sort order in your query? This is pretty simple, and you do not have to resort on the client then. It just is not automatic. Note: SQL is SET ORIENTED. Sets do not have an intrinsic sort order. Thomas Tomiczek THONA Software Consulting Ltd. (Microsoft MVP C#/.NET) (CTO PowerNodes Ltd.) Jon Stonecash === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may
Re: [ADVANCED-DOTNET] Middle-Tier Hosting: Remoting vs. Enterprise Services
a) COM+ is not going to die unless Windows dies. b) Indigo performance is nothing you should look at when the product is not even Beta. c) (to the original poster) Use ASMX by default and ES if you need the services. Forget about Remoting's existence for the network edge unless all you ever want is a reasonably smart data formatter for raw TCP sockets. -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of ADVO Sent: Friday, June 25, 2004 2:21 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Middle-Tier Hosting: Remoting vs. Enterprise Services Actually, Indigo is the only communication/transaction-level platform that Microsoft will support. COM+ (with Enterprise Services as well) will eventually die because Indigo will provide what COM+ can do and more. Indigo will add transparency to you application regarding location, communication way to connect to your remote object/service. The object may be just local, and will be efficiently called inside your process if you wish. It will provide transaction service using which you may execute not only distributed transaction through internet, but also long-running transactions (with ability to roll-back performed operations if the transaction is aborted). BUT 1. This is what Microsoft promises. 2. I wouldn't expect we will get the really reliable solution by 2005. Microsoft planned to release beta version of Indigo in 2004. 3. And I'm now sure about performance: My colleague participated Microsoft's seminars regarding Indigo. Guys there presented simple communication between two distributed web services. The message communicated through Indigo was smth. like Hello world, but he was disappointed with the performance - it took about 10 sec (!) per message. Of course Microsoft will improve that but I still worry about what we will have to work with. Good luck, Roman Koreshkov -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Andy Smith Sent: Thursday, June 24, 2004 8:59 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Middle-Tier Hosting: Remoting vs. Enterprise Services I'm getting conflicting opinions on what is the best technology to host middle-tier .NET components. Mine is a typical 3-tier scenario, with each of the tiers on separate boxes. I've got both internal and external clients that will use these services (components). I was working in an IIS hosted/HTTP binary remoting direction, but now it's been suggested to me that not only will Enterprise Services give me far greater productivity (because of the ability to leverage it's services - transactions, security, etc), but also that it's actually the best migration path to Inidigo, contrary to what many say (including Don Box). Also I'm told that Enterprise Services do NOT involve interop most of the time. I'm just looking for any educated opinions that anyone may have on this topic. I've read mostly negatives about ES and .NET, and never heard that it's the best migration to Indigo. I've got several projects coming down the pipe and I've got to make some decisions quickly, so any input is greatly appreciated. Thanks! === This list is hosted by DevelopMentorR http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] Best Practices: Sharing business assemblies, the GAC, deployment and component versioning
For W2K it's GAC all the time. There are some workarounds, but any of those require reaching so far into the guts of Enterprise Services that you don't really want to have them running in production. Windows Server 2003 is your platform. That's where it's all really nicely integrated. I know that this is a platitude, but one should pick the appropriate platform for a business solution and not do it the other way around. The compromises you need to make on W2K vs. Win03 and the additional dev cost you incur may be very well worth the cost of upgrading (including the upgrade cost in Ops). -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Bill Bassler Sent: Friday, June 04, 2004 1:26 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Best Practices: Sharing business assemblies, the GAC, deployment and component versioning Yes. Unfortunely we're still on W2K here and I believe require dllhost for out of proc components. So is the following correct. If: 1. You're running on W2K. 1. You need to use Serviced components. 2. You want to run them out-of-process. You have to GAC them. Is this correct or do other options? MS has got a real mess with the Component Services integration and .Net. === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] Best Practices: Sharing business assemblies, the GAC, deployment and component versioning
http://staff.newtelligence.net/clemensv/PermaLink.aspx?guid=0615b3cc-0fb f-4cf5-9d49-ae95b50f7e8d (mind URL wrapping) On Windows Server 2003, Enterprise Services no longer requires the GAC. See linked blog post. -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Bill Bassler Sent: Wednesday, June 02, 2004 2:43 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Best Practices: Sharing business assemblies, the GAC, deployment and component versioning Scenario: We have developed several business components. The goal of the business components is to encapsulate common business functionality. We have developed several client applications that use the business component's functionality. All of the common business components are Serviced components because they utilize MTS to commit or rollback any transactions against the database. MTS, of course, requires strong naming. We currently have the business components deployed to the GAC and they are registered as Serviced components. The main reason for using the GAC for deployment was that it made making references among them work without any additional configuration and it also allows for the components to run as Server applications. Issues: While GAC deployment made making inter-component and client referencing easier, it of course forces strict versioning between components and referencing and clients that use them. While I see the benefit in enforcing strict versioning in this scenario, constant vigilence on versioning of shared components and clients can be very painful. Using it implies redeploying any clients and or components that receive a new build number. To date, in development, we've locked the versions but now we'd like to start versioning deployments with build numbers. Main questions: Are there any MS best practices outlined for these situations. I find really nothing comprehensive on the in-and-outs of using the .Net framework along with application and component versioning. In principle, I would not want to privately deploy a copy of each business component to each client that uses it (which happens all the time in the Java world). This really defeats the principle of sharing components. Besides, the use of COM Server application configuration actually precludes its use. I believe this scenario actually requires a strict build process that automates to build process for all related client applications and shared components but I'm trying to verify that this is the case. Additional related questions: Is there a way to tell a client to bind to the assembly with highest build number in the GAC and not to a specific version. Are there other options for sharing strong named business components with multiple clients that don't involve the GAC and versioning? === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] Wait for thread in threadpool to complete.
I know it's a lame answer, but don't do that. Using an open DB connection from more than one thread is pure evil. Get all rows into an array of structures, close the connection and hand the array to the background thread. If all you do is to collect 10 records (or even 100), there's a fair chance that you'll be done copying the data into the array before your thread time slice is up -- and therefore you would even lose time by distributing the fetch operation across multiple threads even if that worked. -cv -Original Message- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Dinesh Ganesan Sent: Thursday, May 13, 2004 11:16 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Wait for thread in threadpool to complete. Hello There, Here is the my algorithm which uses thread pool to process database data row by row. 1. Open a DB connection. 2. Collect 10 records. 3. Create a new thread in thread pool and pass the database connection for each row. 4. Close the database connection. 5. wait for 10 seconds 6. repeat the step 1. Here is the code. SqlConnection m_sqlConn = m_dbMgr.Open(CAFConfig.strDBConn); DataSet dtMessages = (DataSet)m_dbMgr.GetAdapterOutMessages(m_sqlConn); if(dtMessages.Tables[0].Rows.Count == 0 ) Thread.Sleep(1); foreach(DataRow rowMsg in dtMessages.Tables[0].Rows) { ThreadPool.QueueUserWorkItem(new WaitCallback(processMessage),(object)m_sqlConn); } m_dbMgr.Close(m_sqlConn); Question: The SQL connection is getting closed in main thread, but in the child thread its expecting the database connection and throwing an exception. I could solve this by opening/closing database on each thread. Is there any alternative solution?? Thanks Regards, Dinesh G === This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com
Re: [ADVANCED-DOTNET] Throwing exception from pooled .NET dll inside COM+
You simply *shouldn't* throw any exception from the constructor unless you really, really, really need to and want to signal that the component as such is fundamentally broken for this process's life time. The activation of ServicedComponents (SC) and the invocation of activated components are two vastly different stories. Activation of SC's involves the complete COM+ infrastructure, including CoCreateInstance, context setup, context propagation, channel building and all the other goo. At the far end, your constructor is being invoked, but that call is triggered from deeply inside the System.EnterpriseServices infrastructure. So, it's pretty logical that all you're getting is just an HRESULT. Invocation of SC's is pretty much pure .NET Remoting tunneled through COM Transport. With that, .NET exceptions can and will flow properly as they're just part of the return IMessage. JIT Activation's Activate() will work as it's triggered by invocation and not by activation (despite the name). I read between the lines that you want to set up the pooled component in the constructor. Acticate/Deactivate is the more appropriate place. -cv -Original Message- From: Kuthair Habboush [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 19. November 2002 23:30 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Throwing exception from pooled .NET dll inside COM+ Hello, I am having problems throwing an exception from the Constructor of a pooled .NET component inside COM+. When a I throw the error, the message received in a .NET client is Exception from HRESULT: 0x80131500, and the message received in a VB 6.0 client is a simple Automation error. As soon as I turn off the Enable object pooling flag in the component properties of my COM+ package, I get the correct exception message back to the client (the one I typed into my throw statement). Also, this only happens when I throw the exception from the constructor. If I throw the exception from any other method, it works fine. Does anybody know why this is? It makes no difference if the .NET dll is in the GAC. Thank you, -Kuthair Some sample code: = using System; using System.EnterpriseServices; // Application name [assembly: ApplicationName(PooledDll)] // Activate components in a dedicated server process [assembly: ApplicationActivation(ActivationOption.Server)] namespace PooledDll { // Enable object pooling with these defaults [ObjectPooling(true, 4, 12, CreationTimeout = 2)] // Enable JIT activation [JustInTimeActivation(true)] // Enable statistics [EventTrackingEnabled(true)] public class PooledDll : ServicedComponent { public PooledDll() { throw new System.Exception(Hello, this is an exception message.); } public void DoWork() { // do some work } } } _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
Re: [ADVANCED-DOTNET] Problem with COM+ and .NET Enum Parameters in Method definition
Is the serviced component assembly in the GAC? It should be. -cv -Original Message- From: Kuthair Habboush [mailto:khabboush;HOTMAIL.COM] Sent: Mittwoch, 23. Oktober 2002 00:10 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Problem with COM+ and .NET Enum Parameters in Method definition Hello, I am new to this list. I am getting an exception when I'm running a method with enumerated parameters in COM+. I can't figure it out for the life of me, and any assistance you can provide would be greatly appreciated. I created a .NET class in C# that interops with COM and is also installed as a COM+ SERVER package. The problem is when I have an enumerated type as a parameter in a method of my class. Both the .NET class and client compile. And I can instantiate the object no problem, but as soon as I run a method with an enumerated type as a parameter I get the following exception: File or assembly name MyComPlusServer, or one of its dependencies, was not found. at System.EnterpriseServices.IRemoteDispatch.RemoteDispatchNotAutoDone(Stri ng s) at System.EnterpriseServices.RemoteServicedComponentProxy.Invoke(IMessage reqMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData msgData, Int32 type) at MyComPlusServer.MyComPlusServerClass.DoSomething(CarTypes eMyCar) in d:\visual studio projects\mycomplusserver\class1.cs:line 28 at MyComPlusClient.Form1.button1_Click(Object sender, EventArgs e) in d:\visual studio projects\mycomplusclient\form1.cs:line 106 Everything compiles fine, and I can install the server into COM+ (using regsvcs) no problem. This works wonderfully from a VB6 client. It also works when the .NET class is installed as a COM+ library application, instead of a server application. Thanks again, -Kuthair Here is some sample code: = My .NET server class = [assembly: AssemblyKeyFile(mysnk.snk)] [assembly: ApplicationActivation(ActivationOption.Server)] [assembly: ApplicationID(E6F3F75B-9957-4bc9-BA00-ACAD8D7941A6)] [assembly: ApplicationName(MyComPlusServer)] [assembly: Description(Doesn't do much)] using System; using System.Runtime.InteropServices; using System.EnterpriseServices; namespace MyComPlusServer { [Guid(E04A86A4-883E-4f7d-B4FA-A6A1061DFD72)] // Support both early and late-bound calls from an unmanaged client [ClassInterface(ClassInterfaceType.AutoDual)] // Enable ObjectPooling with these defaults [ObjectPooling(true, 4, 12, CreationTimeout = 2)] // Enable JIT activation [JustInTimeActivation(true)] // Enable statistics [EventTrackingEnabled(true)] public class MyComPlusServerClass : ServicedComponent { public enum CarTypes : byte { Ford = 0, Chevy = 22, Chrysler = 5, VW = 99} public MyComPlusServerClass() { } public int DoSomething(CarTypes eMyCar) { // do somework return 100; } } } = My .NET client = private void button1_Click(object sender, System.EventArgs e) { try { MyComPlusServer.MyComPlusServerClass objServerClass = new MyComPlusServer.MyComPlusServerClass(); objServerClass.DoSomething(MyComPlusServer.MyComPlusServerClass.CarTypes .VW); } catch (Exception ex) { MessageBox.Show(ex.Message + System.Environment.NewLine + ex.StackTrace); } } = _ Choose an Internet access plan right for you -- try MSN! http://resourcecenter.msn.com/access/plans/default.asp You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
Re: [ADVANCED-DOTNET] A performace comparison between the TCP and HTTP remoting channels.
Questions: (a) How is the performance difference whenever the code that you are calling actually does something? (b) Most of the shown differences are easily explained considering the protocol characteristics of HTTP vs. reused sockets. What other results do you expect? -cv -Original Message- From: Nicko Cadell [mailto:discuss-develop-advanced-dotnet;THEBAP.ORG] Sent: Montag, 21. Oktober 2002 16:04 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] A performace comparison between the TCP and HTTP remoting channels. I have got some results from testing with the .NET framework 1.1 beta, both in a native 1.1 environment and a mixed 1.0 and 1.1 environment. Note these are all results from comparing TCP and HTTP remoting channels, not web service, which also use HTTP transport, but are hosted in IIS. Running locally on a .NET framework 1.1 beta TestChannels -client Connecting to localhost Testing TCP Channel Done with RegularMethod batch! 3.688 Done with RegularMethodReturn batch! 3.844 Done with OneWay batch! 2.969 DONE Testing TCP Channel Testing HTTP Channel Done with RegularMethod batch! 13.219 Done with RegularMethodReturn batch! 13.593 Done with OneWay batch! 16.485 DONE Testing HTTP Channel Interestingly here the TCP channel and the HTTP channel are slightly faster than under 1.0. The [OneWay] TCP channel has made great improvements and is now faster than the regular method (as it should be). But the HTTP channel's [OneWay] method is going backwards, now it is not only slower under 1.1 than it was under 1.0, but it is now slower than the regular methods. Running with a client on a .NET framework 1.1 beta and the server running on a .NET framework 1.0 sp2. TestChannels -client=hebe Connecting to hebe Testing TCP Channel Done with RegularMethod batch! 3.093 Done with RegularMethodReturn batch! 3.266 Done with OneWay batch! 11.421 DONE Testing TCP Channel Testing HTTP Channel Done with RegularMethod batch! 10.578 Done with RegularMethodReturn batch! 10.906 Done with OneWay batch! 4.422 DONE Testing HTTP Channel Again the across machine version of the tests runs faster than the local across process tests, however the results are more pronounced. The HTTP channel is nearly 3 seconds faster than locally on the same machine. The TCP [OneWay] call is still slow 2.9 seconds locally = 11.4 seconds across the network, but at least it is not the 86.3 seconds it used to take! The HTTP [OneWay] methods are running twice as fast in this combination as previously in a 1.0 to 1.0 networked config. Running with the client on .NET framework 1.0 sp2 and the server running on .NET framework 1.1 beta. TestChannels.exe -client=cupid Connecting to cupid Testing TCP Channel Done with RegularMethod batch! 3.766 Done with RegularMethodReturn batch! 3.984 Done with OneWay batch! 8.203 DONE Testing TCP Channel Testing HTTP Channel Done with RegularMethod batch! 11.829 Done with RegularMethodReturn batch! 12.421 Done with OneWay batch! 9.688 DONE Testing HTTP Channel With the client running on the old 1.0 framework we loose some of our speed shown above. However the [OneWay] methods are again showing interesting results. The TCP channel methods are faster! But the HTTP methods are slower! It looks like the 1.1 framework will make some positive speedups to the remoting layer, but what is going on with those OneWay methods? You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
Re: [ADVANCED-DOTNET] Possible to change type definition when the type is loaded?
-Original Message- From: Ted Neward [mailto:tneward;JAVAGEEKS.COM] Sent: Donnerstag, 17. Oktober 2002 00:37 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Possible to change type definition when the type is loaded? [...] is what I have in mind here), extract the IL, doctor it, and re-emit the assembly for consumption by the CLI. I'm not sure where all the drawbacks would be--this is a totally unproven idea for the CLI. I've done it in Java, though, if that helps. :-) [...] You won't be able to regenerate a strong name. -cv You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
Re: [ADVANCED-DOTNET] Possible to change type definition when the type is loaded?
You need to demand ReflectionPermission with ReflectionEmit enabled. That's, for instance, not grantable for the default Internet permission set. -cv -Original Message- From: Thomas Tomiczek [mailto:t.tomiczek;THONA-CONSULTING.COM] Sent: Donnerstag, 17. Oktober 2002 14:55 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Possible to change type definition when the type is loaded? You are right - the request is about smuggling object persistence in. Basically trying to get rid of the abstract properties and the abstract requirement for the base class. Though it sounds like this will have to wait, then. BTW - reflection.emit can be used to genrate assemblies dynamically even with very low security rights, to my knowledge - the resulting code just needs to pass the verifier. Thomas Tomiczek THONA Consulting Ltd. (Microsoft MVP C#/.NET) -Original Message- From: Clemens F. Vasters [mailto:clemensv;NEWTELLIGENCE.COM] Sent: Donnerstag, 17. Oktober 2002 14:37 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Possible to change type definition when the type is loaded? Thomas, I went through that long time ago and the result was that there is basically no way to get this going without sacrificing too much of the programming model (constructing instances with new, etc.) or without having to make too many preconditions in terms of full trust security and the likes. One thing I tried was to smuggle wrapped classes into the activation chain for context-bound objects, but the activation logic is smart enough to figure out whether there's type spoofing going on under the hood (which is a Good Thing for security). Based on a couple of Daikiri snippets you've been posting here over time, I think I have an impression of what you are trying to do: smuggling automatic object persistence into the code, for instance. Coincidentally, I just dug out one of my earlier .NET lab-projects from back in late 2000 whose programming model looks strikingly similar. Based on what I found back then, the Framework just won't let you do what you are trying to do and eventually abandoned that path (I will look at this again once generics come around with all bells and whistles) You may want to look at a purely interception-driven design that is driven by attributes on the class, but doesn't require any of the infrastructure code be part of the class. Remoting's object-sink is one option here. Another option is to extend things at compile time using a metadata-driven post-compiler that feeds off the compiled metadata and code-generates the actual classes that the clients bind to. That's basically the ASP.NET approach and makes most sense. What needs to be considered with all this is that the code being executed may run with lowered trust and restricted client permissions. Hence, invoking Reflection.Emit or any of the compilers *during a call or during JIT* (opposed to ASP.NET's before handling an entire web request) will just not work in production environments. My 2c -cv You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
Re: [ADVANCED-DOTNET] reloading appdomain of asp.net
How do you kill the AppDomain? How do you tell ASP.NET that you are pulling the carpet under its feet and unload an AppDomain that ASP.NET created and which ASP.NET owns? -cv -Original Message- From: natty [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 18, 2002 7:12 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] reloading appdomain of asp.net Hi, When we develop in DNA we put necessary DLLs (BL, DATA) that we develop in the COM+ as a server. We do it because our server run a lot of applications and this is the only way that we can KILL a DLL (shutdown of package) without shutting down the IIS. With dotnet we understand that every web application running on its own AppDomain and we can unload and load this appdomain, without the need to stop the entire Web. If this works we can put the DLLs in the com+ as library and to gain performance. So we try to develop a tool that will show us all the running application on aspnet_wp.exe so I can unload and load then. It was easy to show all the domains in the aspnet_wp and to unload them. The problem is that once we unload an appdomain we get the error: Server Application Unavailable. Until we stop and start the process. Any ideas Natty Gur, CTO Dao2Com Ltd. 28th Baruch Hirsch st. Bnei-Brak Israel , 51114 Phone Numbers: Office: +972-(0)3-5786668 Fax: +972-(0)3-5703475 Mobile: +972-(0)58-888377 Know the overall picture -Original Message- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED]] On Behalf Of Brady Gaster Sent: Tuesday, September 17, 2002 11:11 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] How to retrieve ParameterInfo values on Del egate parameters? Very good points indeed. We'll chalk this err up as a brainf@$t. Brady Gaster Executive Technology Services [EMAIL PROTECTED] 480.575.3625 office 602.790.2081 mobile -Original Message- From: Ian Griffiths [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 12:12 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] How to retrieve ParameterInfo values on Delegate parameters? I really don't follow what you're trying to do. I can't tell what context you're reading the Method property of the delegate - is the code that's going to invoke the delegate reading it? (If so, surely it knows what is being passed in because it will be the code that gets to decide what is passed in.) Is it the code being called? (If so, surely it knows what it has been passed - it can just go and look at it!) Or is there some other piece of code? The thing is, the only time that any parameter *values* are involved is when the delegate is actually invoked, and the only two parties to that particular operation are the caller and the callee. Both of them know what the parameter is so there's no problem. But if you're looking at a delegate outside of the context of any particular call through the delegate, then there are no parameter values involved - no methods are being invoked so there's no need for any parameters. All that you can discover is what *types* of parameters are allowed to be passed. This is what the Method property's GetParameters method returns. Type information is static - a given delegate type always accepts the same parameter types, and that never changes. Parameters are dynamic - the actual parameters being passed are specific to a particular invocation of the delegate. The delegate's Method property returns you type information (i.e. static information). How could it return anything else? -- Ian Griffiths DevelopMentor - Original Message - From: Brady Gaster [EMAIL PROTECTED] In my application, i have a delegate that looks like this: public delegate void ProcessAutoDelegate(AutoType at) The parameter is an enumeration of type AutoType, within my application. This enumeration contains 5 possible values. What i'm trying to do here is to enable any calling application with the functionality of applying the delegate's functionality only to Automobiles (another class, Automobile) of whatever type was passed in as the parameter to the delegate. The thing is, i can't use the GetParameters() method of the Method property of the delegate, as no value is accessible for the parameter. I guess what i need to know is, how do you look at the value of a parameter dynamically? I've tried various methods of type conversion, but none work. It seems i always get back the type System.Reflection.ParameterInfo. (which, i guess, is to be expected - now how to get the value..?) Within the list archives, there was a link to a thread that was supposedly on this topic, but clicking on the thread led me to an error page (apparently it was a bad link). You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at