February 2012 - Digital Tool Factory blog February 2012 - Digital Tool Factory blog

The Digital Tool Factory Blog

How to fix problems with Visual Studio 2010 Click Once publishing

The Problem

So, you’re trying to publish a desktop app via the Visual Studio 2010 Click Once publishing, and you’re having problems with Visual Studio 2010 Click Once publishing?  Are you getting errors like the part below

Following errors were detected during this operation.
* [2/22/2012 1:45:21 PM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
– Downloading http://www.Domain.com/PublishFiles/SomeApp/Application Files/ReportingApp_1_0_0_8/App_Data/Reporting.sdf.deploy did not succeed.
– Source: System.Deployment
– Stack trace:
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
— Inner Exception —
– The remote server returned an error: (404) Not Found.
– Source: System
– Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

Even though you are not using a .sdf file

The Cause

Somewhere along the way you did have a .sdf file in the app_data folder, and the Click Once deploy manifest listed it. The manifest looks for it and does not find it, and would not find it anyway due to .sdf not being an accepted mime type on your server.

The Solution

Make sure that there are no .sdf files in the app_data folder, do a grep for any .sdf files, and then delete the web directories containing the files, the republish via click once.

Feb 12

Written By Steve French


How to fix problems the Mailbox unavailable. The server response was: 5.7.1 Message rejected as spam by Content Filtering error

The Problem:

You are trying to send an email in C# from your website (using Exchange as the email server), but you get the error message

Mailbox unavailable. The server response was: 5.7.1 Message rejected as spam by Content Filtering.

whenever you send the email.  It is clearly not spam.

The Cause:

You are triggering a spam filter based on the number of words and characthers in the sample email you’re sending.

The Solution:

You should increase the number of words in the body of your email by five or more.  It’s strange, but it works.

Feb 12

Written By Steve French


How to Fix Missing records in Linq to Entities

The Problem

You are attempting to use Linq to Entities in the standard way, your linq model does not seem to have any records attached.  You have missing records in Linq to Entities.

You look in the database, and the proper record is there.  You do a


and it tells you there is one record there, but still when you attempt to actually retrieve a record, for example like


you get a white screen.  What gives?

The Cause

It turns out the offending code looks like this

namespace MyProject.Models
	public class MyEntry
		public int MyEntryId { get; set; }
                public string EmailAddress { get; set; }
                public string LastName { get; set; }
                public string FirstName;

The Solution

Did you notice what was missing?  You don’t have the needed

{ get; set; }

after FirstName, so Linq To Entities will not retrieve the record for the database.  It’s always hard to see something missing, it took me about 20 minutes and lots of checking the wrong places to see the omission with this problem.

Feb 12

Written By Steve French


ASP.Net MVC 3 In Review – One Year Later

'F'kin Computers.' photo (c) 2011, Cameron - license: http://creativecommons.org/licenses/by-sa/2.0/It’s been a little over a year since I’ve devoted myself to Asp.net MVC 3 and on the whole I’m quite impressed.  Microsoft seems to have picked a definite direction for the web (the Microsoft Web Platform Installer makes a nice guide for it), and I like it.  Here is my broad review, please bear in mind I’ve been doing asp.net webforms for about ten years.

The Pros of ASP.Net MVC 3

  1. The Razor View Engine – Brevity is wonderful
  2. The integration with Sql Server and Entity Framework CodeFirst
  3.  The full integration with JQuery
  4. The bare metal approach to html, it is much easier to find bugs in the code when there is less code.
  5. The full integration with Visual Studio 2010 – it is nice to have the platform and the IDE work fully together
  6. NuGet!  The single best way to install add-ons.
  7. The ease of testing your code via the test capabilities of Visual Studio


The Cons of ASP.Net MVC 3

  1. It is a pain to test actual data.  With the advent of code-first one would think that you could simply have a test database, but there is no way.  One has to use db fakes, which makes your entire testing a bit less useful.
  2. Coded User Interface Tests are not baked into the system in any way, and for no particular reason one cannot have CUITS in the same solution as the most popular ASP.net  MVC 3 scaffolding packages.

On the whole, I am a huge fan – for more information about it, check out the wonderful work that Shawn Wildermuth and Scott Hanselman have been doing.

Feb 12

Written By Steve French


How to fix more problems with ASP.net MVC 3 RouteValues

The Problem

You want to create urls that look something like http://SomeSite.com/Categories/Industrial/Fasteners/3.8-MM-Titanium-Wrench-Bolts/ so your site can rank extra high when people search for those profitable 3.8 MM Titanium Wrench Bolts. And in natural, RESTful fashion, your site and database is structured so that the Wrench Bolts are in a subcategory of Fasteners, which are part of the Industrial Category

The Cause:

None really, I’m just listing how one does this sort of thing.

The Solution

Firstly you have to define your route in your global.asax file, in the Register Routes section

“ItemInd”, // Route name
“Categories/{CategoryName}/{SubCategoryName}/{id}”, // URL with parameters
new { controller = “Product”, action = “Details”, CategoryName = “”, SubCategoryName = “”, id = “” } // Parameter defaults

Then you have to set your Route Values
Here is an ActionLink helper –

@Html.ActionLink(p.Name, “Details”, new { controller = “Product”, action = “Details”, CategoryName = p.SubCategory.Category.Name, SubCategoryName = p.SubCategory.Name, id = p.Name })

And if you want to use the URL.Action helper, here is what that would look like.

<a href=”@Url.Action(“Details”, “Product”, new { controller = “Product”, action = “Details”, CategoryName = p.SubCategory.Category.Name, SubCategoryName = p.SubCategory.Name, id = p.Name })”>Some Text</a>

as you might suspect, the new { controller = “Product”, action = “Details”, CategoryName = p.SubCategory.Category.Name, SubCategoryName = p.SubCategory.Name, id = p.Name } maps exactly to the corresponding parts in the global.asax file.

This wasn’t really a how to fix problem, but really more about using asp.net mvc 3 RouteValues.  I’ve found a lack of documentation on how to make relatively complicated urls, so I thought this would be a start!

Feb 12

Written By Steve French


Stronico gets absorbed by Digital Tool Factory

I am giving up the ghost on Stonico.com, and I will soon be shutting down the site and moving 200+ posts from the Stronico blog over here to the Digital Tool Factory blog so they can be part of an actively updated site (thank you 301 redirects).  I expect that to happen slowly over the next two weeks.

Stronico has been a lot of fun and a magnificent learning experience, in product development, programming and business in general.  Primarily what I learned was that there is no market for a visual contact management system. Live and learn!  I with I’d done more research and found it out earlier (like everyone says) but life is one long experiment.

Feb 12

Written By Steve French


How to fix problems with Linq to Xml Namespaces

The Problem

You are trying to read data out of a standard xml file.  I found a great Linq to Xml tutorial here.  You get code that looks something like this

XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath("~/Invoices.xml"));
List<Invoice> lst = new List<Invoice>();
lst= (from c in data.Descendants("invoice")
select new Invoice
ClientName = c.Element("client").Value,
InvoiceDate = Convert.ToDateTime(c.Element("date").Value),

and you get nothing but object type no found errors.  Why?  You have problems with linq to xml namespaces.

The Cause:

The xml file you are trying to read is using a NameSpace!

The Solution:

Add in the namespace declaration and append it to the file in the right places, your code should look something like the below.

XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath(“~/Invoices.xml”));
XNamespace ns = XNamespace.Get(“http://www.SomeProvider.com/api”);
List lst = new List();
lst= (from c in data.Descendants(ns + “invoice”)
select new Invoice
ClientName = c.Element(ns + “client”).Value,
InvoiceDate = Convert.ToDateTime(c.Element(ns + “date”).Value),

Do you see the “ns + ” part?  That tells C# to keep your data and the xml data apart.  And please note, you have to use it everywhere you reference a part of the xml document (I spent an hour finding that out).

That’s it!  Happy Coding.

Feb 12

Written By Steve French


Make Sure to Claim Your About.Me Page

A new service has arisen lately that claims to be a yellow pages for people on the internet.  A page that is about, well… me.  Unlike all previous efforts to create such a thing, About.Me might actually work.  You can see my profile here.

It differs from Facebook in that About.Me is a public site, so it would be a good idea to claim your name while you can before it gets highjacked by the evildoers of the internet.  It’s a free service, and it is probably the best thing you can do to protect your “personal brand”, i.e. the thing that people find when they Google you

Claim Your About.Me page now.

Digital Tool Factory is in no way affiliated with About.Me, and we get nothing from advocating their service.  Many clients have asked us about it lately so we thought we would make it part of the newsletter.

Feb 12

Written By Steve French


Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.