C# or VB.NET?
Poll hosting courtesy: Polldaddy.com. |
o matter how much time passes it seems, the question is always being asked on one project or another: is Java better than Visual Basic? Is C# better than VB.NET?
Linked-In has been playing host to a lengthy, but at times interesting discussion on this question which seems to have an obvious, short answer. Yet in the discussion are useful lessons for less experienced programmers that should be taken to heart…
Some highlight replies I selected from the whole thread:
WS-HTTP-Based Windows Service: Last Choice of WCF Devs?
hile looking for a configuration utility to assist with some WCF development I was doing earlier today, I realized that I’d written an article about that same utility in my blog a while back. And upon clicking the link to where the tool should have been located, got a “not found” error. Further research revealed the location where the author apparently moved it to and I’ve updated the article in question (below) accordingly.
If you find broken links — especially to downloadable media that might be of interest to others — please don’t hesitate to let me know using blog feedback at the bottom of the “About me” page.
ou might not think that WS–HTTP isn’t the last choice of WCF developers when developing a Windows Service. Despite the protocol overhead of HTTP, often developers will default to this protocol in setting up a WCF application because of network rules, compatibility with other applications based on HTTP or just out of raw familiarity. Whatever the reason, HTTP still ends up being the first choice – as it was for me recently (albeit at another’s urging) and, being a veteran of net.tcp, I ran into trouble pretty quick:
HTTP could not register URL http://+:8083/FoaeaService/ApplicationListSystem.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at Justice.FOAEA.MidTier.Services.FoaeaHostService.OnStart(String[] args) in C:\Projects\WCF\ServiceHost\FoaeaHostService.vb:line 77For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Strangely, I didn’t visit the Help and Support Center, as directed at the bottom of the stack trace above. Instead I tinkered with my .config file for about an hour before it dawned on me that the settings were actually correct and I should follow the instructions.
To summarize my visit to the Help and Support Center, there is an extremely obscure tool called HttpCfg.exe which is used on that platform I’m currently developing for – Windows Server 2003 (it’s netsh on Vista/Windows Server 2008, and less obscure). It demands that you divine an arcane string to pass as parameters for your application, security context, etc. Certainly, one could achieve the desired settings to make their HTTP-hosted service work…eventually. But I was fortunate enough to spare myself another indefinite period of maddening trial-and-error by stumbling upon an extremely helpful blog article by one Paul Wheeler, a former Microsoft SDE who apparently did some WCF development for the company’s Connected Systems division. In the article, Wheeler provides a tool for configuring local system HTTP settings with source code under Creative Commons (public license). The tool offers other advantages over HttpCfg for this purpose and was a lucky find indeed!
I am still debating whether or not to push a lot harder to move my app to net.tcp. The decision rests with the project’s technical architect; and I wasn’t he on this project at the time (but, in fact, ended up assuming the Technical Architect role about mid-way through the first phase of the project). But if you, like me, are in a situation requiring HTTP – Wheeler’s HttpNamespaceManager is for you!
Updated: July 26, 2011