I’ve got PDB’s but no line numbers

Recently ran into an issue where we wanted to get line numbers from exception stack traces that are being logged for a clients site. We followed all the instructions we found online but nothing got us what we wanted. We had PDBs for all our DLLs in the bin folder, we tried deploying a full debug version but nothing got us what we wanted. After many searches we came across a mention that if you are having your app impersonate (which we are not) to make sure the account that is being impersonated is a member of the Debugger Users group. Since we are using a custom App Pool Identity we decided it was worth a shot and made the change in AD. Voilà! We’ve got line numbers in our logs and now I can finally fix that pesky null reference exception.

Why it works

There’s more knowledgeable people out there that can explain it better but from my understanding when an exception is thrown and you access the stack trace a debugger instance of sorts is ran on the matching PDB and if the current user does not have correct permissions to perform this action the PDB can’t be processed and you just get minimal information.

QuickBooks crashes when trying to import an iif file

If you find yourself having issues importing an IIF file into Quick Books try checking to see if one of your imported items has a hyphen (-) in its name. Removing the hyphen may fix the issue.

UPDATE 2015-06-15: IIF imports can also crash because of field length limits being exceeded. I’ve encountered scenarios where Quick Books:

  1. will take longer data then the fields max length but will not be able to display it all in app (seen in invoice numbers)
  2. will take longer data then the fields max length but truncates it in system. This can cause duplicate items to be created
  3. crashes immediately

So don’t forget to check the fields max length: Character limitations for fields in QuickBooks

Speeding up GoDaddy Shared Hosting

I’ve recently had the need to use GoDaddy Shared Windows Hosting for a website. In use I’ve noticed the website can load slow after periods of no one using it. Usually a simple enough solution, I just go into IIS and adjust the Application Pools Idle timeout. Well GoDaddy doesn’t give direct access to the Application Pool the website is using through Plesk; they do however allow you to setup scheduled tasks. While doing a quick search I came across this:


Code saved below for posterity:


Type Path
Executable C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Argument -c “(new-object system.net.webclient).downloadstring(‘http://[domain.tld]\[path]\[file_name]‘)”


Type Path
Executable C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP54\php-cgi.exe
Argument G:\PleskVhosts\[domain.tld]\[path]\[file_name]


Schedule whatever code works for you as a new scheduled task and make sure it runs every N minutes to beat the idle timeout.

SQLite and DateTime Columns

Just a heads up, if you’re storing dates into a SQLite database using C# make sure your DateTime has the correct DateTime.Kind set otherwise it will default to GMT. Either use DateTime.UtcNow or set the kind after the fact by calling DateTime.SpecifyKind like so:

var someDate = DateTime.Parse('01/13/1981 12:30:00');
var utc = DateTime.SpecifyKind(someDate , DateTimeKind.Utc); // now we are UTC

Enable “PUT” and “DELETE” verbs in IIS 7+

Is your newly created RESTful Service returning a 405 on your PUT and DELETE actions when running in IIS 7? If so you may need to disable WebDAV.

A quick way to check is to pop the following lines into a Web.config in the root of your application and try again.

  <remove name="WebDAVModule" />
  <remove name="WebDAV" />

UPDATE 2016-04-22: For those .NET users, if your server is still not responding to DELETE or PUT check to ensure that the ExtensionlessUrl-Integrated-4.0 handler is setup to handle the verbs by dropping these additional settings in your web.config

      <remove name="WebDAVModule" />
      <remove name="ExtensionlessUrl-Integrated-4.0" />
      <remove name="WebDAV" />
      <add name="ExtensionlessUrl-Integrated-4.0" path="*." 
      		resourceType="Unspecified" requireAccess="Script" 
      		preCondition="integratedMode,runtimeVersionv4.0" />

When “Get updates for other Microsoft products” doesn’t work

I run into this one every once and awhile. A new VM get’s setup and I go to run Windows Updates.

Windows Update

I immediately want to click the Find out more next to Get updates for other Microsoft products so that I make sure all updates are available. Doing so however causes Internet Explorer to display a page telling me how to run Windows Update. Everytime I run into this I always go to Google to find the workaround I’ve used in the past. Here it is posted for future me:

Create the following in a .VBS on the server (Scary!) and double click it.

Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager")
ServiceManager.ClientApplicationID = "My App"

'add the Microsoft Update Service, GUID
Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")

Viola! Microsoft Updates now included in your update checks.

Source (http://msdn.microsoft.com/en-us/library/windows/desktop/aa826676(v=vs.85).aspx)

Announcing Camstruction


” Camstruction is the world’s first web and mobile application designed to streamline the entire documentation process for your projects. From taking important photos of your project to providing them as documentation when necessary, Camstruction gives you the ability to do so much more to manage your projects efficiently. “

Camstruction is made up of both a Website and an iOS Application. The prime target of Camstruction is construction / work site Inspectors. Using Camstruction an Inspector can document a work site with photos taken from their iPhone. All photos can be geotagged, date stamped and organized into a project. Photos can then be shared via a built-in sharing feature on the Website that generates a shared link that can be emailed to others. The App and Website are both kept in sync automatically as changes are made. Don’t have an iPhone, don’t worry all features are available via the Website and or mobile website as well!

Camstruction was created for a client by the name of Appvantage, Inc.
Read More

Fixing ASP.NET web.config inheritance issues for child applications

Recently while adding a WordPress powered blog as a child application to a ASP.NET 4.5 application in IIS 7.5 I ran into this error:

Unrecognized attribute ‘targetFramework’. Note that attribute names are case-sensitive

Since /blog is setup as a PHP application and I didn’t want to turn on ASP.NET support just so I could stop inheritance through a web.config file I looked for another solution. A quick Google search pulled up this result (Changing ASP.NET web.config inheritance when mixing versions of child applications). According to the article modifying the parent applications web.config taking it from this

 ...your system.web stuff goes here

to this

<location path="." inheritInChildApplications="false">
    ...your system.web stuff goes here

fixes my problem. Great stuff!

Force PDFs to download in IIS 7+

Recently I received a request from a client where they wished to have all PDFs download directly as attachments instead of opening up on an installed viewer on the visitors machine. I instantly started racking my brain as to a quick and simple way to accomplish this.

I remembered reading there was a way to specify how a file downloads directly in an anchor tag in HTML5 (here) but being HTML5 isn’t 100% yet I decided that wasn’t the best way. Being the site was built on the ASP.NET MVC Framework I instantly started going through the quick exercise of creating a controller action that would receive a file name and serve it out through a file result. Knowing this method is wrought with security concerns I locked down the directory where files were pulled from so no matter what was requested the code would only ever look in a single folder on the server.

This method wasn’t ideal but it was quick and it was done. I then start the task of updating all links to point to my newly created action instead of the direct linking to a PDF. After the second change I was already in pain and knew that there must be a better way.

Then I remembered we had the URL Rewriting Module installed for IIS which I had previously used for redirecting all HTTP requests to HTTPS, maybe I could use that for outbound requests as well. A quick Google search later returned this beauty:

<rule name="Forcing Download for PDFs" preCondition="IsPDF">
<match serverVariable="RESPONSE_Content-Disposition" pattern=".*" />
<add input="{REQUEST_FILENAME}" pattern="(.*)\([^/]+).pdf$" />
<action type="Rewrite" value="attachment; filename={C:2}.pdf" />
<preCondition name="IsPDF">
<add input="{REQUEST_FILENAME}" pattern=".pdf$" />

When added to the sites web.config file in between the <system.webServer> tags, IIS 7 (requires URL Rewriter Module) will modify all outbound requests that have: a Content-Disposition header and match a requested file of (.*)\([^/]+).pdf$ and append the appropriate header tag attachment; filename={C:2}.pdf to get the file to download instead of opening up directly in an installed viewer.