Troubleshooting “Service ‘Astoria’ implements multiple ServiceContract types, and no endpoints are defined in the configuration file.”

This is a misleading error that means you forgot to put the connection string into web.config.

So if you get:

WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/63432468
Exception: System.ServiceModel.ServiceActivationException: The service '/Services/Astoria.svc' cannot be activated due to an exception during compilation. The exception message is: Service 'Astoria' implements multiple ServiceContract types, and no endpoints are defined in the configuration file. WebServiceHost can set up default endpoints, but only if the service implements only a single ServiceContract. Either change the service to only implement a single ServiceContract, or else define endpoints for the service explicitly in the configuration file.. ---> System.InvalidOperationException: Service 'Astoria' implements multiple ServiceContract types, and no endpoints are defined in the configuration file. WebServiceHost can set up default endpoints, but only if the service implements only a single ServiceContract. Either change the service to only implement a single ServiceContract, or else define endpoints for the service explicitly in the configuration file.
at System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost host, IDictionary`2 implementedContracts, String multipleContractsErrorMessage)
at System.ServiceModel.Web.WebServiceHost.OnOpening()
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
Process Name: WebDev.WebServer
Process ID: 8168

This is what a connection string for an entity data model looks like. If you created your edmx file in a different project from your .svc file, you will need to manually copy the connection string. In this case I’m using Sqlite (which can’t be design using Visual Studio Express, in case you were wondering)

<add name="calendarEm" connectionString="metadata=res://*/CalendarV1.csdl|res://*/CalendarV1.ssdl|res://*/CalendarV1.msl;provider=System.Data.SQLite;provider connection string="data source=C:\code\CommunityCalendar\Calendar\App_Data\calendar.db3;useutf16encoding=True"" providerName="System.Data.EntityClient" />

Thinking about starting an open source project

I’d like to start an opensource project.

Pick the social contract. I’ve learned the distinction between open source products and open source products. The latter is a social group of people collaborating to create an application. The former is an application that the developer will give the source code for, but doesn’t necessarily do collaborative development outside of processing bug reports, etc.

Pick a host Codeplex is a good host for MS centric projects. Sourceforge is good because it is big. Google code is also not bad.

Check your employment contract and pick a license I can’t help you with the first. As for picking a license, pick something that protects you from lawsuits and is compatible with other open source licenses. Licensing is partly governance, so put some thought into how you plan to govern your application and your relationship with users and other developers.

Pick tools that are widely available. If you can only open the source code with an expensive proprietary IDE, you won’t find many friends to help you. In the .NET world, the ideal project would be able to compile in Visual Studio Express and MonoDevelop.

Pick compatible libraries. Closed source applications have an easier time here. If you are completely ripping off someone’s libraries in an intranet application, the rights holders might never discover. In an open source application, it will eventually get indexed and lawyers will look over your code looking for lawsuit opportunities.

Don’t make it hard to install You may love SQL Server. But taking a dependency on something as user friendly as SQL Server will decimate your potential user base. In the case of SQL Server, either choose SQL Compact or Sqlite. MySql has the the problems as SQL–it is a bit to hard for people to use. Your app will not likely have a DBA– even if a company picks up your product, it will likely be a small company that still doesn’t have a DBA. It should work by unzipping into a directory and be portable on a thumb drive.

Ask for help Ask for help in your app– set up something like a uservoice page for feature requests and discussion, a bug tracker that accepts public input.

SQL Express on Windows Home Server

SQL Express 2008 Hates WHS. So I have Windows Home Server. Finally, I think, I can run a publicly accessible Windows 2003 box with SQL from my bedroom and the licensing is all pretty legit. I try to install SQL2008 from the Web plantform installer. It barfs. I read this blog post and try again, without the platform installer. It appears to install, but then it fails to start. The error logs claim that the master DB is on an E: drive. I try to uninstall. The un-installer says the attributes on the folders are different, so it refuses to uninstall. Reported bug on MS connecte.

Ok, 1/2 GB of space on my WHS burned with no way of deleting it. I even tried zipping the folder and then deleting the program files\Microsoft SQL folder, but it says some file is in use. Sigh.

SQL 2005 Reporting Services Hates SSL certs on IIS 6 on WHS. So I try to install SQL Express. Reporting services barfs on install (“SQL Server Setup failed to retrieve the SSL Certificate Name”) because it doesn’t like the perfectly valid SSL certificate. The web says rip out your SSL certificate and SSRS will install. Right, like I’d want to rip out my left eyeball. WHS doesn’t have a louse selfssl cert, it has a green ssl cert from Green! Do you know how much it costs to get a green certificate? So I try again without RS. This time, the SqlNativeClient fails. It says it can’t find an MSI, sqlncli.msi. (follow link for the real fix, which is to uninstall the snc from previous attempts) And the install fails. I suspect it is because the installer automatically unpacks to the D:\guid folder. But the D: drive is some super weird NTFS configuration that most programs don’t know how to read or write to, unless they use the UNC or shared folders.

I finally succeeded before I had to try MSDB or MySQL. Next time, I’m going to seriously consider MySQL probably with XAMPP because XAMPP hasn’t sold their soul to the registry, the team that uses MSI installers and other evil things.

Kinds of Anonymity

Technical Anonymity. You use proxies, avoid cookies, you browser leaks no information about your IP, computer or other characteristics about your network traffic and computer. Your cover is blown as soon as you include your name, or other correlating information in a blog entry. Your cover will also be blown as soon as the intermediate parties (the proxy owner, the email provider) decides to hand over your information, say under legal pressures from the government.

Who needs technical anonymity? Spammers and people who’ve violated TOS clauses only need technical anonymity, because the traces that technical anonymity techniques remove the clues that web sites use to ban bad actors. Spammers don’t care if people know who they are as long as they can send email with being automatically ID’d as spammers.

Real humans need social and legal anonymity more than technical anonymity.

Social Anonymity. You don’t include your name or any other correlating information. You even try to change your writing style to avoid tools that correlated your favorite ways to misspell words with other documents on the web you publish under your real name. If the people who want to know who you are lack the resources or skill to trace IP addresses and correlate your ID from scraps of info like cookies and information leaked by your browser, then this can be done probably without any technical anonymity.

Who needs social anonymity? Bloggers and people writing about anything that might piss of the Jones up the street. If you decide you don’t want to be harassed for your religion, politics, personal behavior, etc, you might rather to be anonymous instead of being silenced by your personal enemies. For example, if you want to blog about politics, you don’t want it to ruin your chances of getting a job. These people will not user the courts to extract your ID from a commercial proxy service.

Legal anonymity. You are at risk of being throw into jail or losing your job if your ID is discovered– either because the government is corrupt, your company is evil or you really are a criminal. This is the hardest level to achieve because getting the email and proxy requires relying on 3rd parties to move your network traffic and those parties can be subject to government pressure to fork over your ID. Even commercial anonymity services don’t want to protect tax dodgers, mass murderers or spammers.

Sounds hard, is this a fools errand? Technical anonymity is possible, but you are likely to make mistakes, especially over a long period of time. Social anonymity is possible, but the odds of subtle mistakes are very high. Legal anonymity is probably impossible unless you make sure all your intermediate parties are outside your legal jurisdiction. However, as soon as your ID is being protected by a party outside the law, they you can’t enforce your contract with them regarding how they keep your ID safe! Imagine a proxy server company in Bahama that goes bankrupt and sells it’s assets with scraps of your ID to a US company and then your cover is blown again.

Why not use Tor? Tor would make legal anonymity easier because it isn’t a company and it mixes up tons of legal juridsictions, but the performance of the Tor network makes it unusable.

The Anonymous Web

This is the flips side of what I usually work with: figuring out who really is at the other end of an HTTP request. What if some one doesn’t want to be known at all? It turns out to be as hard as proving you are who you say you are!

Tor. Re-route your traffic through a few nodes donated by nice people until your point of origin is hard to trace. Free. Down side, performance is about 100 times slower than without Tor. And I measure that. It’s slower than a modem on a noisy line. The system is currently overrun by bittorrent traffic and there are no incentives to be an exit node: no money and the exit node owners get blamed for the IP laws broken while traversing them.

Commercial Proxies. I tried out Anonymizer. Performance is good, but you can’t directly sign up for email accounts when your IP is proxied. The email providers assume you are a spammer if you are trying to create an account while proxied.

Java Applets, your browser, etc.. All of these fancy client features leak information about who you are. Java applets can even get an honest answer about your unproxied IP address even when your browser is only reporting the proxied IP address! I think, for a nosy website to use this info, they’d have to have a special crafted java applet, AFAIK, an ordinary applet doesn’t leak information.

You’d think that with all this leaked info, we could use it to ID someone routinely, but IP tracing is hard detective work. You’d have to be doing something remarkable to make it worth someone’s effort to track you down by the crumbs you leave when surfing.

Social Engineering Still Rules. I imagine that if a user covered all their tracks, as soon as they accidentally say something online that ties them to a particular person in real life, the game is over.

WHS Accomplishments

I should have a badge page to show off what I’m currently using my WHS for.

- Recording radio on a schedule every night. (Doesn’t interfer with daytime bandwidth!)
- Serving up Eclipse by bit torrent (charitable bandwidth donation)
- Backup my workstations (of course, also works as system partition expander)
- Boinc (charitable CPU and electricity donation)

- Record my podcasts in off hours (hard, because of need to get the files to synch to itunes)
- Record video in off hours (maybe using Miro, but I watch so little TV, it’s not such a priority)
- Convert my movies to IPod in off hours
- Set up SVN (tricky!)
- Make WHS a usable global “My Music” folder. Challenge is that media libraries get polluted with un-sorted and non-music files.
- Set up 24 hour recording security cam (webcam)

- Set up TOR exit point (donate firewall avoidance software to iranians and/or online hooligans. Not trying to imply that they’re overlapping sets

List vs Collection

FXCop doesn’t like List. It says use Collection *if* you are writing a public API and the List or Collection is exposed to the outside world.

Why? Because Collection can be extended and List can’t. Put it another way, if use List, you’re locked into the feature set of List

How? They aren’t exactly the same, Collection doesn’t sort. You can’t cast List to Collection (at least not without making a copy, and that would be inefficient)

So this is okay:

class Foo
public int foobar()
List blah;
//Use it, but don’t ask for it in a parameter or return as value.

WHS: What I use it for

I’ve use it twice to expand a system partition, something that is very hard to do with ordinary re-partitioning tools. It is far easier to backup and restore to a larger system partition, IF you have windows home server.

WHS still doesn’t help you in setting up the boot menu and it won’t help you fiddle with the BIOS or warn you if your BIOS is incapable of dealing with a drive larger than 32GB.

I have set up music, but the music is a confused jumble of foreign language words, audio books and music. Same mess that I get from itunes and WMP. The PS3 can connect and so can ITunes, but so far I haven’t found a solution to the most compelling use case, which is to get music to my kitchen. You can’t stream music across to the kitchen if there isn’t a PC there there, huh?

I set up the photos and Flickr integration, although I’m not sure it will replace the Flickr uploader. It might.

Like any always on computer, my mind turns towards setting up bit-torrent and BOINC, so I can donate bandwidth and CPU cycles. Bit torrent was very hard to set up. I’m still looking for files worth sharing on bit torrent, I will probably settle on Mono ISOs if I can’t find anything else. I won’t be doing folding at home, because it is so much more efficient to do F@H on a PS3 and I already do that.

My Mac book is now a earthquake detection node! See:

The 1.5 TB got used up quick. As it turns out, I have 5 computers around my small apartment that need backup. Two of them are on the same machine (i.e. dual boots). It looks like I’ll need to buy a minimum of two more TB, fortunately, that can be as cheap as $140.

I’ve also set up a web cam on my WHS, but there are two issues. I can’t record and the WHS is sitting in my bedroom. Why would I want to record that? I’d rather record the a view of people walking in the front door. Or if the web cam would track, I’d record my cat walking around.

DVR- Digital Video Recording and DAR- Digital Audio Recording
I’ve read at least one person successfully installed Miro.
I wish I could install itunes on my WHS, I should try. I’d rather my podcasts were downloaded on an always on machine.

Still haven’t found a internet radio recorder that I like yet.

My windows server now lets me get remote desktop and wake on LAN for any PC in the apartment. I will soon put that to the test. AFAIK, WHS doesn’t provide any help with the BIOS configuration to make wake-on-LAN work.

I still need to find a cable to turn my WHS into a print server. However, if I did that, it wouldn’t do wake on LAN for the printer.

I should try to do some powershell scripting. I haven’t exercised the PowerShell part of my brain enough recently.

I’m thinking I should use my WHS as sort of a staging platform for my personal ASP.NET projects.

And it might make for a good subversion server.