473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DotNet Interface to IIS? Not working

Environment: Windows 2000 Server SP4, IIS5.0, Dot Net Framework 1.1

Situation:
A Console application that send an email using System.Web.Mail.MailMessage

Observation:
1) Recently, the application is failing to deliver messages!
2) Even when eMails was delivered, there are no entries logged in the SMTP
Log files!
3) I have carried out the following test
3.1) On the Win2K Server where the mail console app is installed, I have
configured Outlook Express to try to send mail using SMTP Server
theServerName, and mail is delivered successfully, with
3.1.1) SMTP Log logging Outlook Express communicating with the IIS Virtual
SMTP Server
3.1.2) SMTP Virtual Server logging relaying the message to external SMTP
Server.

Settings on IIS Virtual SMTP Server
1) Access- Only the list below (127.0.0.1 + the server's IP address)
2) Relay- Only the list below (127.0.0.1 + the server's IP address)- Allow
all computers which successfully authenticate to relay, regardless of the
list above
3) Authentication- Anonymous Access, Basic authentication, Windows Security
package
Default settings for every thing else

Code Snippet-
using System.Web.Mail;
using System.Diagnostics;

[STAThread]
static void Main(string[] args)
{
Class1 cls = new Class1();
cls.createFile();
}

public void createEmail(string sFilePath)
{
// Note this method is explicitly not handling exception. The calling
method should handle it and log to event viewer
MailMessage mail = new MailMessage();
mail.From = sSalesEmail;
mail.To = sExportEmail;

mail.Subject = "Daily order email";

mail.BodyFormat = MailFormat.Text;
MailAttachment attachement = new MailAttachment(sFilePath);
mail.Attachments.Add(attachement);
SmtpMail.Send(mail);
}

public void createFile()
{
try
{
createEmail(strFilePath); //Create the email and send
}

catch(Exception ex)
{
Logging.LogError("Emailer",ex.ToString());
}
}

My biggest biggest concern now is nothing is logged when mail is sent, so I
cannot figure out where the problem lies! How could I fix this? Note that
there are nothing in the bad mail, queued, etc. directory for the email
which should have been sent but haven't.

I have also made one additional interestin observation!
1) Stop SMTP Virtual server on IIS
2) Run the emailing console app
3) Nothing logged in Event Viewer to indicate failure/exceptions in
SmtpMail.Send(mail)
4) Start IIS SMTP Virtual Server
5) Mail relayed successfully (but still nothing logged in SMTP Log file)
Nov 18 '05 #1
6 2401
Please respond to microsoft.public.dotnet.framework and
microsoft.public.inetserver.iis

(Sorry, posted to microsoft.public.dotnet.framework.aspnet by mistake).

"Patrick" <pa**@reply.newsgroup.msn.com> wrote in message
news:uJ*************@TK2MSFTNGP10.phx.gbl...
Environment: Windows 2000 Server SP4, IIS5.0, Dot Net Framework 1.1

Situation:
A Console application that send an email using System.Web.Mail.MailMessage

Observation:
1) Recently, the application is failing to deliver messages!
2) Even when eMails was delivered, there are no entries logged in the SMTP
Log files!
3) I have carried out the following test
3.1) On the Win2K Server where the mail console app is installed, I have
configured Outlook Express to try to send mail using SMTP Server
theServerName, and mail is delivered successfully, with
3.1.1) SMTP Log logging Outlook Express communicating with the IIS Virtual SMTP Server
3.1.2) SMTP Virtual Server logging relaying the message to external SMTP
Server.

Settings on IIS Virtual SMTP Server
1) Access- Only the list below (127.0.0.1 + the server's IP address)
2) Relay- Only the list below (127.0.0.1 + the server's IP address)- Allow
all computers which successfully authenticate to relay, regardless of the
list above
3) Authentication- Anonymous Access, Basic authentication, Windows Security package
Default settings for every thing else

Code Snippet-
using System.Web.Mail;
using System.Diagnostics;

[STAThread]
static void Main(string[] args)
{
Class1 cls = new Class1();
cls.createFile();
}

public void createEmail(string sFilePath)
{
// Note this method is explicitly not handling exception. The calling
method should handle it and log to event viewer
MailMessage mail = new MailMessage();
mail.From = sSalesEmail;
mail.To = sExportEmail;

mail.Subject = "Daily order email";

mail.BodyFormat = MailFormat.Text;
MailAttachment attachement = new MailAttachment(sFilePath);
mail.Attachments.Add(attachement);
SmtpMail.Send(mail);
}

public void createFile()
{
try
{
createEmail(strFilePath); //Create the email and send
}

catch(Exception ex)
{
Logging.LogError("Emailer",ex.ToString());
}
}

My biggest biggest concern now is nothing is logged when mail is sent, so I cannot figure out where the problem lies! How could I fix this? Note that there are nothing in the bad mail, queued, etc. directory for the email
which should have been sent but haven't.

I have also made one additional interestin observation!
1) Stop SMTP Virtual server on IIS
2) Run the emailing console app
3) Nothing logged in Event Viewer to indicate failure/exceptions in
SmtpMail.Send(mail)
4) Start IIS SMTP Virtual Server
5) Mail relayed successfully (but still nothing logged in SMTP Log file)

Nov 18 '05 #2
Hi Patrick,

Nevermind, I think we can still discussing this issue here and please post
in the proper group next time:).

From your description, you found your console Applicatoin which use the
System.Web.Mail 's component to send mail not work and without any
exception thrown. Also, you're using the local IIS's smtp Server as the
Smtp Server, yes?

As for this problem, I've also generated a simple test on my side(on a
win2k server with iis5 .net1.1). At first , I also met the problem you
mentioned, the web application run correctly without any exception, but the
mail didn't be sent to the target address. Also, I've check the logfiles in
the "{driver}:\WINNT\system32\LogFiles\SMTPSVC1" foler and found no logs in
it. However, I found that all the mails are queued in the
"{dirver}:\Inetpub\mailroot\Queue" folder. And I also check the EventLog
and found some warnings in it indicate that the mail can't be correctly
sent. After we check the smtp Server's setting and retest again, all the
mails queued in the "{dirver}:\Inetpub\mailroot\Queue" are sent correctly
and also we can find the logs in the
"{driver}:\WINNT\system32\LogFiles\SMTPSVC1" folder.
So currently I think we can perform the following steps:
1. Deleting all the files in the "{dirver}:\Inetpub\mailroot\Queue" folder
and rerun your console appliation to test. After send serveral mails, if
the target user haven't recieved the mail, check the
"{dirver}:\Inetpub\mailroot\Queue" folder to see whether those mails are
there. If they're queued there, we can confirm that the .net code
(System.Web.Mail) is running well and the problem is on the smtpServer
because the System.Web.Mail 's code just help to delivered the mail to the
SMTP server and the mail is actually sent out by the smtpServer.

2. Please double check the eventviewer to see whether there're any warning
or errors indicate failing to send mail.
Also, we need to check the local SMTPServer's setting.

3. After setting the smtpServer, recheck the
"{dirver}:\Inetpub\mailroot\Queue" folder , if the queued mail in it are
all sent out,(the folder become empty), that means the mail has really been
sent out to the target user.

Please check the above things. If you have any updates, please feel free to
post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3
This problem is weird and is happening intermittently on a *Production* environment, so I can't do too much on the production environment. However, I could confir
- The Warnings on SMTPSVC in Event Viewer were in regards to a email domain to which the emailing application was not emailin
- Nothing in the SMTP Log files!! (despite logging being enabled explicity, with all fields ticked
- There are items in the Badmail directory, but they were not the ones the emailing application generate

The lack of SMTP Log files mean I cannot track down where the problem lies! I am particularly concern that when SMTP Server is stopped the console application returned with no exceptions!! (Is this by design)

I am particularly very interested in what you did to the Virtual SMTP Server (on IIS5.0 on Windows 2000 SP4 Domain Controller, with all latest patches) to get log entries from being generated even when the mails are sent successfully

Have you tried the following
1) Stop IIS Virtual SMTP Serve
2) Run the application that try to send email (in my case, no exceptions
3) Start IIS Virtual SMTP Serve

I am very concern that log entries are not generated for email sent from the console application. Is this a bug, by design (can't think of why though??), or a "configuration" issue

Btw, what kind of application were you running and in what context when you did manage to get System.Web.Mail to send mail and have the SMTP Log file entry populated? (Mine is a console application, running as a Domain Administrator)

Btw, how could I use System.Diagnostics.Trace to trace to an output file from a console application. I know in ASP.NET, it is jus
<system.diagnostics><trace autoflush="true" indentsize="3"><listeners><add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\\temp\\TraceFile2.txt"/><remove type="System.Diagnostics.DefaultTraceListener"/></listeners></trace></system.diagnostics><system.web><trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/></system.web

But this doesn't work on a console application!
Nov 18 '05 #4
Hi Patrick,

Did you get any 4000 or 4001 SMTPSVC warning events in event log? If
so, please paste the details here for us to take a look. The events
can be helpful to determine the problem cause.

Best regards,

WenJun Zhang
Microsoft Online Support
This posting is provided "AS IS" with no warranties, and confers no
rights.
Get Secure! - www.microsoft.com/security

Nov 18 '05 #5
No joy, email are still not logged!

"Patrick" <pa**@reply.newsgroup.msn.com> wrote in message
news:78**********************************@microsof t.com...
This problem is weird and is happening intermittently on a *Production* environment, so I can't do too much on the production environment. However,
I could confirm - The Warnings on SMTPSVC in Event Viewer were in regards to a email domain to which the emailing application was not emailing - Nothing in the SMTP Log files!! (despite logging being enabled explicity, with all fields ticked) - There are items in the Badmail directory, but they were not the ones the emailing application generated
The lack of SMTP Log files mean I cannot track down where the problem lies! I am particularly concern that when SMTP Server is stopped the
console application returned with no exceptions!! (Is this by design)?
I am particularly very interested in what you did to the Virtual SMTP Server (on IIS5.0 on Windows 2000 SP4 Domain Controller, with all latest
patches) to get log entries from being generated even when the mails are
sent successfully.
Have you tried the following-
1) Stop IIS Virtual SMTP Server
2) Run the application that try to send email (in my case, no exceptions)
3) Start IIS Virtual SMTP Server

I am very concern that log entries are not generated for email sent from the console application. Is this a bug, by design (can't think of why
though??), or a "configuration" issue?
Btw, what kind of application were you running and in what context when you did manage to get System.Web.Mail to send mail and have the SMTP Log
file entry populated? (Mine is a console application, running as a Domain
Administrator).
Btw, how could I use System.Diagnostics.Trace to trace to an output file from a console application. I know in ASP.NET, it is just <system.diagnostics><trace autoflush="true" indentsize="3"><listeners><add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\\temp\\TraceFile2.txt"/><remove
type="System.Diagnostics.DefaultTraceListener"/></listeners></trace></system
..diagnostics><system.web><trace enabled="true" requestLimit="10"
pageOutput="false" traceMode="SortByTime" localOnly="true"/></system.web>
But this doesn't work on a console application!

Nov 18 '05 #6
Hi Patrick,

As I've mentioned in my former reply, the SMTP mail's log won't be created
before the mail queued in the "{dirver}:\Inetpub\mailroot\Queue" folder,
so please check that folder, if all the mails are blocked there, of cousre
we won't find any logs in the log folder. And the problem is in the SMTP
server's configuration. As WenJun Zhang has mentioned, have you found any
4000 or 4001 SMTPSVC warning events in event log? If so, I think it's
better that you provide the detailed error info here so that we can have a
check to see whether there is anything set incorreclty. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Joe Bloggs | last post by:
Hi all, I take the pleasure to inform that Dotnet Commons Logging has been released for use. Dotnet Commons Logging, a subproject of the Donet Commons project currently located under the...
9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
2
by: Todd Brooks | last post by:
I have a coclass that implements a dual interface. The thing that's a little unusual is that the coclass doesn't inherit directly from the interface, rather it inherits from an implementation class...
1
by: Chip | last post by:
Hi - I know that this is a naive newbe question... But I need to create a DotNet "something" that can be discovered via a Com interface, and I'm not sure what type of "whatever" I need to be...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
6
by: Ben | last post by:
Hi all, First i have to state this is my first entry ever in a forum. So please be forgiving... I am a newbe to dotnet versioning... The Situation is the following: Our application is using...
1
by: Filip Fransen | last post by:
Hi, I have a to create a com object from a dotnet class. Now I have the following questions : - with Queryinterface you can get all the interfaces from a com app. How can I expose my dotnet...
3
by: Jim Horvath | last post by:
I know how to create exe applications in dotnet that use functions supplied by pre-existing dlls. How do you turn that around? I want to create an exe program that will be the pre-existing piece....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.