I have a “Website” in IIS. It had a virtual directory with SSL working. I added a second virtual directory for another external client.

I’m using SOAP-UI to test. It works fine with normal http, but gives an http status of 404 when I use https.

Example URL:
https://wstest.mydomain.com/App1/myService.svc
https://wstest.mydomain.com/App2/myNewService.svc

I’ve looked at the IIS logs, nothing exciting to report from there.
(This is on Win 2008/R2.)

It turns out that the web.config of the one not working had:

          <security mode="None" />


and I simply changed it to:

          <security mode="Transport" />

I spent about three hours chasing down these errors

Three Different Errors in my IIS Log

When using Port:

80040213 The_transport_failed_to_connect_to_the_server.

8004020f [no text, just this code]

When using Pickup Directory”

80040222 The_pickup_directory_path_is_required_and_was_not_specified

So when reading other blogs, they often tell you to change from Pickup Directory to Port or vise versa.

Context

This code below came from an old Windows 2003 machine running IIS.  I’m migrating to an Amazon EC2 instance running Windows 2012.  My application is a classic ASP application that I have never rewritten.  I remember having similar difficulties back then, decided Microsoft’s SMTP was too complicated, tried some others, and ended up running MailEnable.

CODE

I have a VBScript Class in a separate file that can be shared by any program that needs to send an email.  That’s the first block of code below.  The second block of is uses the class to try to send the email.  It was bombing on the line that said “cdomsg.Send”.

<%

Class Mail
public emailTo
public emailFrom
public emailSubject
public emailBody

public function send

Set cdomsg = CreateObject(“CDO.Message”)

Set iConf = Server.CreateObject(“CDO.Configuration”)

Set Flds = iConf.Fields

‘ Neal changed 12/12/2007 – was getting error:
‘ Arguments are of the wrong type, are out of acceptable range,
‘ or are in conflict with one another
‘ Actually – had to add the MetaData clause at the top
Flds.Item(cdoSendUsingMethod) = 1 ‘ 1=pickup 2=port
‘ The value of 2 might require a user/pass, but you must specify port & server
‘Flds.Item(“http://schemas.microsoft.com/cdo/configuration/sendusername”) = “MyUser”
‘Flds.Item(“http://schemas.microsoft.com/cdo/configuration/sendusername”) = “MyPass”
Flds.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory”) = “c:\inetpub\mailroot\pickup”

‘Flds.Item(cdoSMTPServer) = “127.0.0.1”
Flds.Item(cdoSMTPServer) = “localhost”
Flds.Item(cdoSMTPServerPort) = 25
Flds.Item(cdoSMTPconnectiontimeout) = 10
Flds.Update

Set cdomsg.Configuration = iConf

cdomsg.from = emailFrom
cdomsg.to = emailTo
cdomsg.subject = emailSubject
cdomsg.textbody = emailBody
cdomsg.Send
Set cdomsg = Nothing ‘ not allowed to reuse it for another message
end function

End Class
%>


<%
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library"-->
Response.Write "Attempt to send mail "
Set objMail = new Mail
objMail.emailFrom = "me@mydomain.com"
objMail.emailTo = "you@mydomain.com"
objMail.emailSubject = "TestMail.asp from mydomain.com server"
objMail.emailBody = "Body of email, this is a test"
objMail.Send  ' was getting error on this line when attempting to send email
Set objMail = Nothing ' not allowed to reuse it for another message
Response.Write "Mail sent"
%>

The Steps I Took To Solve the Problem

Obviously, I had to get IIS installed.  One possible issue is that I installed it, but I didn’t configure it.

1. I basically followed these steps to Setup and Configure SMTP.   I did not setup their firewall rules, because I’m running IIS and SMTP on the very same server. I did one thing not on their list. From the “Security” tab of the SMTP Virtual Server Properties, I added the local user account tied to the Application Pool.

2. I did add a local user account, assigned that account to my IIS Application Pool, restart the app pool.  I gave that account access to my IIS files directory, and to the pickup directory.  At this point, I’m not sure that was needed or not.

3. I never got to work using 2=port, only 1=pickup.

Flds.Item(cdoSendUsingMethod) = 1 ‘ 1=pickup 2=port

If you specify 1 for pickup, then I now am pretty certain you must also specify the pickup directory name:

Flds.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory”) = “c:\inetpub\mailroot\pickup”

I’m guessing that CDONTs writes to that directory, and that write access is required for the user running the App Pool.

Not having the “pickup directory” specified was causing this error:  80040222 The_pickup_directory_path_is_required_and_was_not_specified

Followup: Later I plan to try one of my other IIS websites, to see if they work “as is”, or if they need a local account and security granted as well.

One of the errors I had to overcome with IIS version 8 was: “IIS8 – The binding “*:80′ is assigned to another site “. I’m upgrading from a Windows 2003 server that I’ve had since about 2007 to Windows 2012/R2 hosted on Amazon EC2 (Elastic Cloud).

I only run three sites on it at this time.  One reason I need IIS is that my original shopping cart was written in “Classic ASP”, and I developed over 480 asp programs that I never felt like rewriting.  Many of them are now obsolete, but my first plan is to get to a new environment, then slowly upgrade the code.

I started selling a Hebrew tutorial on the internet back in about 1999.  I was a Microsoft Certified Trainer and teaching a lot of Visual Interdev classes (that was the Visual Studio tool to edit websites and .asp code).  Because of that, I decided to write my own shopping cart as a learning adventure, and it’s been very stable over the years.   When .NET first came out, i considered a re-write, but I had the attitude that “if it ain’t broke, don’t fix it”.

Anyway, that’s the background.  Here’s one of the fun issues I encountered with IIS8.  Like the code above, usually this is a set and forget operation.  At work, usually other teams configure IIS to domains, so it’s rare I play with real domains on IIS.

Error: “IIS8 – The binding “*:80′ is assigned to another site “.

When I was adding my second site, I got this error.

IIS8_theBinding80IsAssignedToAnotherSite

That basically means that I already had another website with no HostName, the same IP address (which was set to “All Unassigned”, that also uses Port 80.

This orcsweb blog seems to do the best job at explaining how to setup bindings for IIS (regardless of the release).

Once I put in my domain name for the “Host name” it worked fine.

I’m currently experimenting with a subdomain, such  test.Wisdom-Calls.com, so that I can have the same site on both the old and new server until I can make sure it’s working.  I’ll post back later with the results of that test.

The question that still remains is can you put a non-Domain name in the “Host Name”.  I tried “test”, and was able to add the site.  But when I went to an html file and clicked “Browse”, it loaded for just an instant as http://test/mytestprogram.asp, but then it suddenly switches to http;//test.com/mytstprogram.asp.  Test.com is a real domain owned by someone else, and the redirect to the home page: https://www.test.com/index.html.

How to Change Bindings in IIS8

To change the bindings, you mus tright click then select “Edit Bindings…”.  I have no idea why there isn’t an icon in the “Features View” tab for that.

IIS8_Set_Bindings

 

In another blog, I’ll explain how I set up GoDaddy to work with Amazon EC2 and my “Elastic IP Address”.

 

 

 

 

Believe it or not, WCF is not “turned on” by default in IIS 7.

Run ?servicemodelreg -i? from

c:WindowsMicrosoft.NETFrameworkv3.0Windows Communication Foundation

Sorry, I don’t have the System.Exception right now, but it basically said that BizTalk did not receive a response from the Web Service, and the error was in System.Model…

I went to the IIS server, and browsed the System Event Log and found this message:

System EventLog (not Application EventLog):
Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1011
Date: 12/1/2008
Time: 3:29:06 PM
User: N/A
Computer: S-SV-ES01-WSV01
Description:
A process serving application pool ‘DefaultAppPool’ suffered a fatal communication error with the World Wide Web Publishing Service. The process id was ‘19164’. The data field contains the error number.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 8007006d

Googling on the code above 8007006D indicated that the application pool was crashing.

Eventually, we discovered that we needed to install .NET 3.5 SP1, and it resolved this problem.

This site provided some info, but turned out to be a waste of time for our specific scenario:
Blogs.MSDN.Com (David Wang)

System.Net.WebException: Unable to connect to remote server System.et.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:80



For me, this was an easy one, IIS was down.

Other ideas:
1) Check app.exe.config and make sure URL is corect
2) Make sure machine name is correct http://xxxxxxxx or http://localhost