Thursday, September 20, 2007

The type 'namespace.ClassName', provided as the Service attribute value in the ServiceHost directive could not be found.

So I'm working through my WCF Step-by-step using my favourite langauge, VB.NET, although the book is written in C#! No VB.NET code here so I have to translate and type, no copy paste for me. Well after carefully crafting an interface as the public part of my service and implementing the interface in a class, I build the svc file just like the book and get

The type 'Products.ProductsServiceImpl', provided as the Service attribute value in the ServiceHost directive could not be found.

I think this is a typo, so I check my namespace, OK, I check the Class that implents the interface and it checks out, so I google a bit and some say, you need the fully qualified name. hmmm So I take of the rootnamespace on the assembly and all is OK. But this is not the way to fix problems, I want my rootnamspace so I decide to alter the svc to look like this:

ServiceHost Service="ProductsService.Products.ProductsServiceImpl"

Looks good but then I get another error:

Service 'ProductsService.Products.ProductsServiceImpl' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

So lets look in the Web.config, under system.serviceModel section:

service behaviorconfiguration="ProductsBehavior" name="Products.ProductsServiceImpl"
endpoint address="" contract="Products.IProductsService" binding="basicHttpBinding"

Ohhh the servicename and the contract are now wrong:


Ah at last the service is up and running and browsing the svc file in IE7 shows me the link to the WSDL and all is well.

TechEd Developers 2007 BCN

Wow a year has past since the last conference and it looks like I'll be returning to Barcelona this year for THE developer conference in Europe, Microsoft TechEd Developers 2007. I will be attending to the Hands-on-Labs as a Proctor for the duration of the conference as well as taking a shift at the Ask-The-Experts booth, most likely for Visual Studio 2005. Well As things start to develop I'll keep posting the details, but for now it's flights and accomodation that I need to take care of!!

Saturday, September 15, 2007

Multithreading with VB.NET Series - Part 1

So yes we all know that VB can now multithread with so much ease that we can get ourselves into trouble!! Tell m e about it, I was a victim of a naive assumption once which brought a SQL server to a grinding halt after it spawned 700 threads when a user press the damn button 7 times to make sure the 100 transactions went through!! The data was fine but the server was 'crying' for resources. Anyway that's another story...

So to create a new thread to do some work it a POC:

Dim th As New System.Threading.Thread(AddressOf MyLongRunningProc)
' Kick off that new thread to do some work

Private Sub MyLongRunningProc()
' Do the hard work here !!
End Sub

The questions that start to arise as you move into the world or asynchronous programming will soon start to pop up, due to most peoples affinity to synchronous programming mind set. So if two things are happening at once how do I keep track of progress, access shared data in a safe manner, etc. Well here MS has given us so many toys to play with, enter:
1. The Monitor,
2. The Mutex,
3. ReaderWriterLock
4. The Interlocked Type
5. The SyncLock Statement,
6. The Synchronization and MethodImpl Attributes,
7. VolatileRead/Write and MemoryBarrier,
8. The Semaphore Type.

So over the next few posts I will try to demystify so of these terms you may have heard about, but were to too afraid to use them. This should hopefully put some pretty cool tools into you toolbox to help you create those responsive applications you love to give to your clients, but also to make them more robust and safe :)