Adding printer with "Internet Printing" gives "Windows couldn’t connect to the printer. Check the printer name and try again."

The scenario is as follows, you have set up your Windows 2008 machine to be using “Internet Printing”.

After having set this up you will have the following directory created on your machine:

 

C:\Windows\Web\Printers

 

In IIS manager you will have this directory setup as a virtual directory:

 

 

Now you try to add a printer by using http. I.e on the client machine you go to “Control Panel”, then “Devices and Printers”, then you select “Add Printer”.

Here you select the option “Select a shared printer by name” and enter the printer name with the https:// prefix. For example:

 

https://yourserver/Printers/SpikePrint/.printer

 

This will then give the following error:

 

Connect to Printer

 

Windows couldn’t connect to the printer. Check the printer name and try again.

If this is a network printer, make sure that the printer is turned on, and that the printer address is correct.

 

 

There are two possible reasons for this. Or rather, two that I have found:

Reason #1:

 

The application pool being used is running as 32 bit on a 64 bit machine.

In other words, the “enable32BitAppOnWin64” property for the application pool is set to “true".

If you look in the IIS logs and see this:

 

<date><time> GET /Printers/SpikePrint/.printer - 80 <user> <ip> Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0) 500 0 126 15

 

Or if you use a browser and navigate to the address you used for the printer and you get this:

 

HTTP Error 500.0 - Internal Server Error

There is a problem with the resource you are looking for, so it cannot be displayed.

Detailed Error Information

 

Module IsapiModule

Notification ExecuteRequestHandler

Handler AboMapperCustom-12305953

Error Code 0x8007007e

Requested URL https://yourserver/Printers/SpikePrint/.printer

Physical Path C:\Windows\web\printers\SpikePrint\.printer

 

Then if checking the 126 error shown for the error in the IIS logs with “net helpmsg” you will see this:

 

C:\Windows\system32>net helpmsg 126

The specified module could not be found.

 

And/or checking the 0x8007007e seen in the error page with the ERR tool ( https://www.microsoft.com/en-us/download/details.aspx?id=985 ) you will see this:

 

C:\ERR>err 0x8007007e

  ERROR_MOD_NOT_FOUND

# The specified module could not be found.

 

So now we know that a module can’t be found. And in this case it is this one:

 

C:\Windows\system32\msw3prt.dll

 

 

As you can see, this is in the 64 bit Windows location and not in the 32 bit Windows location (i.e.: C:\Windows\SysWOW64 ).

 

So in short, the solution here is to change the application pool used so that it runs in 64 bit mode. This will allow the msw3prt.dll to be found.

Change this in the advanced settings for the application pool by setting the “enable32BitAppOnWin64” property for the application pool is set to “FALSE".

 

 

Reason #2:

 

You are missing the handler mapping altogether.

In other words IIS do not know what to do with the request since it doesn’t know how to handle the .printer extension.

If you look in the IIS logs and see this:

 

<date><time> POST /Printers/SpikePrint/.printer - 80 <user> <ip> Internet+Print+Provider 404 0 2 0

 

Or if you use a browser and navigate to the address you used for the printer and you get this:

 

Module IIS Web Core

Notification MapRequestHandler

Handler StaticFile

Error Code 0x80070002

Requested URL https://<yourserver>/Printers/SpikePrint/.printer

Physical Path C:\Windows\web\printers\SpikePrint\.printer

 

You are most likely getting issues because of this.

 

Then if checking the 2 error shown for the error in the IIS logs with “net helpmsg” you will see this:

 

C:\Windows\system32>net helpmsg 2

The system cannot find the file specified.

 

And/or checking the 0x80070002 seen in the error page with the ERR tool ( https://www.microsoft.com/en-us/download/details.aspx?id=985 ) you will see this:

 

C:\ERR>err 0x80070002

# for hex 0x80070002 / decimal -2147024894 :

  COR_E_FILENOTFOUND

 

In this case you can add the handler in the Handler Mappings in IIS Manager. Or simply add a web.config file (or edit an existing one) with the following content:

 

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <system.webServer>

        <handlers>

            <add name="AboMapperCustom" path="*.printer" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\System32\msw3prt.dll" resourceType="Unspecified" preCondition="bitness64" />

        </handlers>

    </system.webServer>

</configuration>

 

Hope this helps!