Console App Service or ATL Service - com

I need to create a service. I know that you can do it with just a console application but it can also be done with ATL.. What are the benefits of the ATL Service vs a simple console application service? I understand that ATL is COM.. but what are the benefits of COM with the service.. thanks!

The service doesn't exactly benefit from COM, but rather the other way around.
By hosting your COM objects in a service, you get all the system features of services (startup before users log on, controlled policies watchdog, configuration of identity, etc.)
ATL gives you the opportunity to run your COM objects in a service context, as opposed to in-process (DLL) or regular out-of-process hosting. COM+ is another alternative for customized hosting.
If your service is just a background service, adding COM support could give you simple programmability, but otherwise I don't see any benefits.
So, I'm not sure that answers your question... The question feels backward :)

Related

Reference another VB.NET exe that has COM visible TRUE

I would like to mimic the behaviour of a VB6-Active-X-Exe.
To do that, I have created a new project and set its settings to "COM Visible=True".
I can now add this .exe to my main application, and I can call it, call functions in that .exe, etc.
However, it is not really out of process, I think.
I would therefore like to investigate more about such an .exe's behaviour.
But I did not find any official documentation on it.
Can somebody tell me where to find more info?
Thank you!
Out-of-process COM servers (ActiveX EXE's) are not as easy to create with VB.NET as they were with VB6. When you reference a .NET executable (as a .NET assembly reference, not as a COM reference) from another .NET project, it always treats it as in in-process library. The .NET Framework has no direct equivalent to COM's out-of-process servers. Typically, in such scenarios, it is recommended that you create a WCF service, a web service, or use .NET remoting. WCF services are preferred since they use the most modern technology of the three.
However, since .NET supports COM interoperability, it is technically possible to create a .NET executable which can be registered as a out-of-process COM server. Then, when another .NET project references it via COM (rather than as a .NET assembly reference) it will run out-of-process. Microsoft provides an example of how to do that here.
However, if you don't need it to be COM (so that it can be used by non-.NET applications), I would recommend that you go the pure .NET WCF service route.

PerSession WCF Service with Callback for Silverlight client

We would like to develop WCF service for SL clients, which should support session management (PerSession) and callbacks. The WCF service would be hosted as a Windows service.
What would be best WCF binding choice (wsdual, pollingDuplex, any other)? Please also provide for/against points.
Regards,
There are no others. Silverlight does not support WSDualHttpBinding. You can choose PollingDuplexHttpBinding or PollingDuplexHttpBinding.
Have been working a little more in this area and it appears this is an area of constant and recent change. As of Silverlight 4, NetTcpTransport and HttpTransport are both supported using either text or binary encoding. It appears SL5 delivers further enhancements.
There is an interesting benchmark app here which allows you to profile relative performance of the two protocols. Though it was built for SL4, you can download, update the target framework to SL5 and see how it goes. It is a great way to make sure you've got everything setup properly.
Using NetTcpTransport should mean you can also use PerSession instancing on the server.

is there any way to add non silverlight assembly to a silverlight project?

I want to add non-silverlight assembly to a silverlight project,
is there any way to do this? or what will be the other option to do ?
As Andrey writes, it's impossible to add a non-Silverlight assembly to a Silverlight project. If you really need to use it, you have no option but to run it server-side. You may already have a Web project that goes with the Silverlight project, and if so, that's where you should add a reference to this assembly.
The technology used to make remote calls from Silverlight to the web project is WCF RIA Services. The page I linked to contains plenty of documentation and videos to help you learn about WCF RIA Services.
There are, however, a few situations in which this approach won't work. Perhaps none of them apply to your circumstances, but since you don't provide any details about this assembly, I can't be sure.
If, for example, your assembly contains some WPF controls and you want to add them to your Silverlight application, you're out of luck. You'll have to find Silverlight-specific equivalents.
If you'll be calling this assembly frequently, you might find your Silverlight application spending a lot of time waiting for the server to respond. This could slow your application down significantly.
If your application needs to be able to run out-of-the-browser and disconnected from the internet (a requirement of my current Silverlight project), you will also be out of luck.
There are a number of things that I can think of that should work reasonably well over WCF RIA Services:
sending email, calling web services or various other network-related activities,
talking to a database,
mathematical calculations.
It is impossible because Silverlight has different runtime from full .net framework. The common way to solve it is to create WCF service that will have access to that assembly and provide remote access for Silverlight application.

WCF - IIS vs Custom Hosts

I've been working with WCF fairly extensively for over two years now and have almost always taken the "lazy" route and deployed everything through IIS. Some of the reading I've done lately is starting to trend to where developers are using custom hosts in windows services or as console applications. Is there major benefits to switching over to that paradigm or is my current strategy of hosting everything in IIS give me everything I need to do WCF services?
When you go the self-hosting route, you limit the scalability & reliability options of your services. If scalability isn't a concern, you still need to consider all the service monitoring functionality that you'd have to create to be sure your services are running reliably.
If I had to pick two reasons to prefer IIS hosting over self-hosting they would be the flexibility of the WAS service instantiation model for IIS 7.x and the Windows Server AppFabric features for WCF 4.
If you're using a pre-WAS version of IIS (5 or 6), Windows services may be your best (only?) good bet for hosting WCF services that communicate via named pipes or netTCP (anything other than HTTP).
In the 3rd Edition of Programming WCF Services (link), Lowy suggests using Windows Server AppFabric in some situations, and suggests self hosting in a few cases - when you need to use the service bus and IIS 7.5 is not available, for example. Pages 22 and 23 show a couple of simple charts to help determine when to use self hosting over IIS, WAS or AppFabric. I think the first chapter (maybe more) is available for free if you get a Kindle sample.
Other than these scenarios, I'm not sure why you'd ever want to chose any sort of self-hosting over WAS. I'm curious to see if anyone presents good reasons.

Why it's not possible to host an ASP.Net web service other then IIS?

I am just curious to know the reason why it's not possible to host an ASP.Net web service other then IIS ? While in WCF it's possible to host a service in IIS, WAS or any console application.
Please clear the doubt..
ASP.NET is actually not specifically bound to IIS. The .NET Framework includes an HttpRuntime which may be used to write a custom hosting platform. You could easily write a console application, like you can for WCF, that will provide the ASP.NET runtime without IIS.
Technically speaking, you could also write an Apache module that hooked into either a separate .NET process hosting the ASP.NET HttpRuntime, or possibly hook directly into a .NET assembly. I don't know much about writing extensions to Apache, however assuming you can bridge the Apache unmanage to .NET managed gap, you would be able to host ASP.NET in Apache (which should be possible, you might need a native & managed C++ library to mediate.)
Microsoft's .NET framework is amazingly extensible. You can pretty much achieve whatever you set your mind to, if you have the will and the time (and perhaps the funds.) However, the .NET platform does encapsulate an immense amount of functionality, and it is up to Microsoft to choose how they spend their money. Naturally, they have their own business to worry about, and I would not expect them to expend tremendous amounts of money giving a leading edge to their competitors (it would be bad business, and quite a disappointing competitive practice, if you ask me.)