A simple problem (I hope) and info request

Mar 27, 2013 at 6:52 PM
Since it is Easter week, I am not expecting much of a response until next week.

1) I am following the article on SOA (http://www.code-magazine.com/article.aspx?quickid=1203061&page=1). When I run the Host Services module, the Net.Tcp service runs fine, but all the HTTP services fail ("The address
'http://localhost/dev/ICustomerService/rest/json' is already in use by some other application/process" and "HTTP could not register URL http://+:80/dev/ICustomerService/rest/json/ because TCP port 80 is being used by another application.") I am sure this is a simple setting I need to make, but not sure which. I have tried running VS 2012 as Administrator (per the article) but that didn't help. I tried to go to LocalHost in a browser (generates a 404) and I can't find any reference to any webserver (Apache, IIS, Glassfish, etc.) running as a process or service (nor do I know why any of these would be running at this time anyway.)

Since I can use the Net.Tcp for now, this isn't a big deal, but I am curious.

2) In the article, on the last page, you discuss “In-Process hosting”. Where would I get more information on how to set this up for my app which runs against an SQL server running on the LAN?

Happy Easter!
Coordinator
Apr 1, 2013 at 2:59 PM
Do you have Skype running by any chance? Skype can screw this up big time, but you can assign it a different port in the settings. That fixed the problem for me.

To do in-process hosting, you need to add all the DLLs the services uses to your local project (reference) and then use the local service garden to indicate which services you want to host in-process. I should do a quick-tip about that. I don't think we have one so far.

Markus
Apr 1, 2013 at 10:34 PM
Edited Apr 2, 2013 at 3:59 AM
Markus,

I figured it was something simple - and it was. I started VS 1st and it ran just fine. I opened Skype and unchecked the use port 80 option in the tools/advanced/connection settings. Do you know if this is all I need to do or if there is another setting I should set (other than loading VS first, of course.)

All the examples I have found on creating views just use a local class that simulates a backend. Are there any articles/docs on implementing the UI by using the various options provided by the Host project I can look at?

As I understand it, a recommended way to use CODE FW is as follows:
1) Create a solution that can be used to build the host. In this one, at a businessObjects type project (for the EF if using that), add a contracts project and define the contracts, add an implementation project which should define the basic classes for each contract created, and then add the host service which should then expose those classes via the various HTTP/TCP approaches. Save & Close the solution.

2) Create a new solution (yes, I know both can be in the same solution - but this makes it easier for me to keep the right code in the right place) and add the contracts project. Then add a new MVVM project. In that, create the various controllers for each service type in the host we will support. Then create the ViewModels for each controller in the appropriate Models folder tree and the UI views in the appropriate Views folder tree. I am currently working on the ways to connect the 2 and think I have figured it out, but will know more soon.

And I will be on the lookout for the quick-tip on using a local, in-process host service.

Thanks
Coordinator
Apr 3, 2013 at 6:05 PM
For the service stuff, have you taken a look at this article? http://www.codemag.com/Article/1203061 - I think this provides the answers you are looking for.

BTW: If you can, keeping the service and the client project in the same solution, at least initially, makes things MUCH easier, because otherwise, you constantly have to copy the contract DLLs around, which can be a major pain.

Markus
Coordinator
Apr 3, 2013 at 7:27 PM
FYI: I have posted a Quick Tip on the Skype problem, since it seems to be something people commonly run into, especially in Windows 8:
http://codeframework.codeplex.com/wikipage?title=Fixing%20Service%20Hosting%20Security%20Errors

Markus