Upgrade to WCF 4.0 and my Singleton stopped working - wcf

I have a service decorated as a singleton. It is hosted in IIS on my Windows 7 development machine.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
Prior to the upgrade I had migrated all my projects to use VS2010, but stayed in .NET 3.5; I had verified that everything was working correctly.
After I upgraded all of the projects to use .NET 4.0, my WCF service started behaving incorrectly. Each call to the WCF Service creates a new object, which is clearly not how it is decorated (see above). I also upgraded the application pool to use 4.0 with an integrated pipeline (previously it was 2.0 with an integrated pipeline)
Has anyone experienced anything like this? I dont even know where to begin to troubleshoot this.

OK, I finally figured this out. We were using code the read the configuration, as well as created a compression channel based on code from Pablo Cibraro and Rodolfo Finochieti. Apparently, this code is not compatible with 4.0.
Once the compression and adhoc configuration reader code was removed, the problem went away.

Related

Delphi 7 WSDL Importer does not retrieve types from WCF service

I am developing a WCF service (with .NET Framework 4.5), which should simplify the interoperability between clients developed in other languages and my SDK.
The problem is that when using the WSDL Importer providing the WSDL URL from service, it can only bring the Interfaces without any Type.
I tested with others URLs present in tutorials on the internet and the problem does not exist.
For example, when using the WSDL importer to http://www.webservicex.net/WeatherForecast.asmx?WSDL, Interfaces and Types are both brought.
The problem occurs even in a clean project Application WCF, testing with his IService1, and Service1 CompositeType (I'm using Visual Studio 2015).
In tests with Java clients, everything went well. But it was Java 8. Which leads me to suspect that it is a communication protocol version problem or something like this, but I can not know exactly where is the problem.

browser keeps downloading .svc files WCF

Been doing this for hours now and it drives me nuts.
On windows 7 I installed IIS 7.5 through add windows features, also installed WCF HTTP activation, also did all the command line registrations.
In VS 2013 I have a WCF Services project that runes very fine when I run it in IIS express but I want to test it together with my front-end.
But when I browse to my .svc file in the browser it just keeps getting downloaded, been searching google but get wrong results all the time, hopefully! Someone can help me.
Greets
If your WCF Service is in .Net Framework 4.0/4.5, then check the .Net Framework version in Application Pool.
If it is 2.xxxxxx, change it to 4.xxxxx.

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.

Calling a .NET 4.0 component by .NET 1.1

I work at a financial institution, in a team whick takes care of a "home-made" corporate component. This component was built using .NET 1.1, and the other teams use it a lot, specially along with the legacy systems (the ones which are still in .NET 1.1 too)!
Now we want to upgrade this component to .NET 4.0 so we can use some new features (in fact, we want to use Websphere MQ, and its .NET library was build over .NET 2.0). However, can't simply change the runtime of our component, because our internal clients can't afford with an upgrade to their systems.
So, we need to keep a .NET 1.1 component working as a proxy to some service built in .NET 4.0. This was where my question came from: how this interoperability can be made? My first answer was using .NET Remoting 4.0 to comunicate these two parts. Although we can use a WCF service exposed with a HTTP binding (the .NET 1.1 component uses it as it was a ASMX web service), .NET Remoting has proven its performance advantage over the previous solution, but it's a legacy framework (http://msdn.microsoft.com/en-us/library/kwdt6w2k.aspx).
What I'd like to know is if you guys have another idea to do this interop. Is there a way to call a WCF service exposed with the netTCP binding by a .NET 1.1 client?
Thanks a lot!
The real solution is to get over the problems that are forcing you to use unsupported software (.NET 1.1). Then you won't have to do horrible things like the following:
Create a .NET 4.0 class library.
Add a Service Reference to your WCF service.
Create classes and interfaces which can be used to call the WCF service.
Expose them as COM classes and interfaces
Have your .NET 1.1 code consume the COM object and make calls through it
Would be, "compare the amount of effort you just spent on trying to make obsolete unsupported code work vs. the amount of new, useful work you just did".
Note also that this technique quite rightly places .NET 1.1 in the same category as Classic ASP in terms of its ability to use modern software like WCF.
Finally, note that I haven't found a way to make the WCF client in this situation to use a config file. It was necessary to configure it in code.
Is there a reason why you can't port the component and have two versions (a 1.1 version and a 4.0) version? That would let the legacy apps continue to use the component, but your 4.0 stuff could use a newer version without all the complexity required in your proposed solution.
Different versions of .net assemblies can play nice with each other, you aren't forced to only have one version of the component.

WCF Service VS IIS 7.0 VS IIS7.5

I got WCF Service with Fluent NHibernate. When I host it in in IIS7.5 on my development machine(WIN7) it works fine. Worker process shows the clear garbage collection indication of my app pool.
But when I moved to production, which is a Windows Server 2008 with IIS7, Garbage collection is not working, and the virtual bytes in worker process keeps on increasing and got out of memory.
The app pool is configured as Integrated .net 2.0. Has anyone experienced this, or is it a known issue with IIS7.0, or do I miss any settings in my configuration file?
I already tried with timely recycling but it did not have any effect.
Regards,
Pradeep
There are some references to garbage collection running less often on windows 2008 IIS7, than on a development machine, see for example: GC Not Running Often Enough on IIS 7 Application - Windows Server 2008
However, if you are hitting this problem your code is written in such a way that objects are left for the garbage collection to clean up. You should try disposing objects and suppressing finalizations, see http://msdn.microsoft.com/en-us/library/ms973837.aspx especially the code example at the end of the article.