So when reading other blogs, they often tell you to change from Pickup Directory to Port or vise versa.
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.
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”.
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”
cdomsg.from = emailFrom
cdomsg.to = emailTo
cdomsg.subject = emailSubject
cdomsg.textbody = emailBody
Set cdomsg = Nothing ‘ not allowed to reuse it for another message
<!--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 = "email@example.com"
objMail.emailTo = "firstname.lastname@example.org"
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.
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.
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.
In another blog, I’ll explain how I set up GoDaddy to work with Amazon EC2 and my “Elastic IP Address”.
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
Time: 3:29:06 PM
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.
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.