SMTPClient的奇怪问题 [英] Weird Issues with SMTPClient

查看:318
本文介绍了SMTPClient的奇怪问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,


我仍​​然很新,但是我正在浏览ASP.net 2.0

释放的书,首先章节并尝试编写我自己的小表格

电子邮件以获取乐趣。我尝试在

书中遵循他们的版本代码,尽我所能,并且遇到了问题,主要是在尝试编译时需要

类型MS Visual Studio 2002.

当我的东西根本不工作时,我决定尝试几乎完全使用他的

代码。我将它从CD复制到我的文件夹,并编辑了

只是我自己的电子邮件地址,所以它不会出现意外的某些地方。它所使用的系统是Windows .net Server 2003

标准版。我在运行页面时遇到的错误是:


---开始粘贴---


编译错误


描述:编译资源期间发生错误

为此请求提供服务。请查看以下具体的

错误详细信息并正确修改源代码。


编译器错误消息:BC30182:预期类型。

来源错误:



第5行:


第6行:Sub Page_Load()


第7行:昏暗客户端为新SmtpClient()


第8行:client.Host =" localhost"


第9行:client.Port = 25

源文件:c:\inetpub \wwwroot \ smtpclient \ SendMail.aspx行:7



显示详细的编译器输出:


C:\ WINDOWS \ system32>

" C:\ WINDOWS \ MicrosoftMosrosoft.NET \ Framework \v2.0.50727 \ vbc .exe" / t:library

/ utf8output

/R:"C:\WINDOWS\assembly\GAC_32\System.Web\.0.0.0.0__ b03f5f7f11d50a3a \ System.Web.dll"

/R:"C:\WINDOWS\assembly\GAC_MSIL \System.Xml \\\ 2.0.0.0 __b77a5c561934e089 \ System.Xml.dll" ;

/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\ 2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll"

/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \T emporary ASP.NET

Files \ smtpclient \ 8f865d90\1728c4ff\assembly\dl3\dd e41090\1037aa00_40b8c601\smtpclient.DLL"

/ R:" C:\ WINDOWS \assembly\GAC_32 \ System .EnterpriseSer vices \2.0.0.0__b03f5f7f11d50a3a \ System.EnterpriseS ervices.dll"

/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configurati on\ 2.0.0.0__b0 3f5f7f11d50a3a\System.Configuration。 dll

/R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b7 7a5c561934e089\System.dll"

/R:"C:\WINDOWS\assembly\GAC_32\System.Data\\\ 2.0.0.0_ _b77a5c561934e089\System.Data.dll"

/ R:" C :\ WINDOWS \assembly \ GAC_MSIL \System.Web.Service s \\\ 2.0.0.0__b03f5f7f11d50a3a \ System.Web.Services.dl l"

/ R:" C: \ WINDOWS \assembly\GAC_MSIL \System.Drawing \2.0 .0.0__b03f5f7f11d50a3a \ System.Drawing.dll"

/ R:" C:\ WINDOWS \ Microsoft。 NET\Framework\v2.0.50727 \T emporary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff\App_global.asax .5w9amsgm.dll"

/out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \Temporary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff \\ \\App_Web_nfetm-v4.dll& QUOT; / D:DEBUG = 1

/ debug + / define:_MYTYPE = \" Web \"

/imports:Microsoft.VisualBasic,System,System.Collec tions,System.Collections.Specialized,System.Config uration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.SessionS tate,System.Web.Security,System.Web。 Profile,System .Web.UI,System.Web.UI.WebControls,System.Web.UI.We bControls.WebParts,System.Web.UI.HtmlControls

" C:\ WINDOWS \\ \\ Microsoft /.NET \ Framework \v2.0.50727 \Tem porary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.0.vb"

" C:\ WINDOWS \ MicroStoswork \ Framework \v2.0.50727 \Tem porary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff \ App_Web_nfetm-v4.1.vb"


Microsoft(R)Visual Basic编译器版本8.0.50727.42



版权所有(c)Microsoft Corporation。保留所有权利。


c:\inetpub \wwwroot \ smtpclient \ SendMail.aspx(7):错误BC30182:预期类型。


Dim client As New SmtpClient()

----结束粘贴----

我没有smtp邮件设置在那台服务器上,但是在尝试我的

其他表格的时候,我改变了主机和端口,它应该在哪里使用邮件服务器。我甚至在端口上运行tcpdump

(通过并行运行所有这些)并且没有发送任何内容。对于一些

原因SmtpClient只是不能正常工作。这是因为我/ b $ b有一个旧版本的Visual Studio(2002)吗?我应该考虑升级到2005年吗?b $ b升级到2005年?我有一个Windows Mobile 2005 PDA,这是我想要获得.net 2005的主要原因 - 是否还有其他

优势?


感谢你对这个错误的帮助,到目前为止,我的.net开始是一个小小的

粗糙,但是我希望自己能够越来越好

书。如果这个问题过于新手喜欢,我会提前道歉。


谢谢,


David

推荐答案

大卫通过这个网站,这将有助于开始。
http://www.systemnetmail.com/

希望有所帮助

Patrick


< David Tholewrote in message

news:20 ****************** @ News.GigaNews.Com .. 。
David go through this site it would help to get started.
http://www.systemnetmail.com/
hope that helps
Patrick

<David Tholewrote in message
news:20******************@News.GigaNews.Com...

嘿所有,


我仍​​然很新,但我正在通过ASP。 net 2.0

释放书籍,第一章并尝试编写我自己的小表格

电子邮件以获取乐趣。我尝试在书中使用他们的版本中的代码

到我最好的能力,并遇到了一些问题,大多数情况下,当尝试编译时,预计会出现类型

MS Visual Studio 2002.当我的

的东西根本不起作用时,我决定尝试使用他的代码几乎完全是
。我将它从CD复制到我的文件夹,然后只编辑了电子邮件

地址到我自己的地址,这样它就不会出现意外的情况。

它所使用的系统是Windows .net Server 2003 Standard。我得到的错误,

在运行页面时是:


---开始粘贴---


编译错误

描述:编译资源期间发生错误

为此请求提供服务。请查看以下具体的

错误详情并适当修改源代码。


编译器错误消息:BC30182:预期类型。


来源错误:



第5行:

第6行:Sub Page_Load()


第7行:昏暗的客户端为新的SmtpClient()


第8行:client.Host =" localhost"


第9行:client.Port = 25


源文件:c:\inetpub \wwwroot \ smtpclient \ SendMail.aspx行:7



显示详细的编译器输出:



C:\ WINDOWS \ system32>

" C:\ WINDOWS \ MicrosoftMosrosoft.NET \ Framework \v2.0.50727 \ vbc .exe" / t:library

/ utf8output

/R:"C:\WINDOWS\assembly\GAC_32\System.Web\.0.0.0.0__ b03f5f7f11d50a3a \ System.Web.dll"

/R:"C:\WINDOWS\assembly\GAC_MSIL \System.Xml \\\ 2.0.0.0 __b77a5c561934e089 \ System.Xml.dll" ;

/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\ 2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll"

/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \T emporary ASP.NET

Files \ smtpclient \ 8f865d90\1728c4ff\assembly\dl3\dd e41090\1037aa00_40b8c601\smtpclient.DLL"

/ R:" C:\ WINDOWS \assembly\GAC_32 \ System .EnterpriseSer vices \2.0.0.0__b03f5f7f11d50a3a \ System.EnterpriseS ervices.dll"

/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configurati on\ 2.0.0.0__b0 3f5f7f11d50a3a\System.Configuration。 dll

/R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b7 7a5c561934e089\System.dll"

/R:"C:\WINDOWS\assembly\GAC_32\System.Data\\\ 2.0.0.0_ _b77a5c561934e089\System.Data.dll"

/ R:" C :\ WINDOWS \assembly \ GAC_MSIL \System.Web.Service s \\\ 2.0.0.0__b03f5f7f11d50a3a \ System.Web.Services.dl l"

/ R:" C: \ WINDOWS \assembly\GAC_MSIL \System.Drawing \2.0 .0.0__b03f5f7f11d50a3a \ System.Drawing.dll"

/ R:" C:\ WINDOWS \ Microsoft。 NET\Framework\v2.0.50727 \T emporary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff\App_global.asax .5w9amsgm.dll"

/out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \Temporary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff \\ \\App_Web_nfetm-v4.dll& QUOT; / D:DEBUG = 1

/ debug + / define:_MYTYPE = \" Web \"

/imports:Microsoft.VisualBasic,System,System.Collec tions,System.Collections.Specialized,System.Config uration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.SessionS tate,System.Web.Security,System.Web。 Profile,System .Web.UI,System.Web.UI.WebControls,System.Web.UI.We bControls.WebParts,System.Web.UI.HtmlControls

" C:\ WINDOWS \\ \\ Microsoft /.NET \ Framework \v2.0.50727 \Tem porary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.0.vb"

" C:\ WINDOWS \ MicroStoswork \ Framework \v2.0.50727 \Tem porary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff \ App_Web_nfetm-v4.1.vb"



Microsoft(R)Visual Basic编译器版本8.0.50727.42


for Microsoft(R).NET Framework版本2.0.50727.42


版权所有(c)Microsoft Corporation。保留所有权利。


c:\inetpub \wwwroot \ smtpclient \ SendMail.aspx(7):错误BC30182:输入

预期。


昏暗的客户端作为新的SmtpClient()



----结束粘贴----


我没有在该服务器上设置smtp邮件,但在尝试我的其他

表单时,我根据应该使用的地方更改了主机和端口

邮件服务器。我甚至在端口上运行tcpdump(通过parallels运行所有这些

)并且没有发送任何内容。由于某种原因,SmtpClient

只是无法正常工作。这是因为我有一个旧版本的

Visual Studio(2002)?我应该考虑升级到2005年吗?我有一个

windows mobile 2005 PDA,这是我想要获得的主要原因

.net 2005 - 还有其他任何优势吗?


感谢你对这个错误的帮助,我的.net开始有点粗糙

到目前为止,但我希望随着我的进展而变得更好书。如果这个问题过于新手喜欢,我会提前道歉。


谢谢,


David
Hey all,

I''m still very new at all this, but am going through the ASP.net 2.0
unleashed book, first chapter and trying to program my own little form
emailer for fun. I tried following the code for their version in the book
to the best of my abiltiies, and came across issues, mostly that a type
was expected when trying to compile in MS Visual Studio 2002. When my
stuff wasn''t working at all, I decided to try just using his code almost
exactly. I copied it from the CD to my folder, and edited just the e-mail
addresses to my very own so that it wasn''t going somewhere unexpected.
The system it''s on is Windows .net Server 2003 Standard. The error I got,
when running the page was:

---BEGIN PASTE---

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: BC30182: Type expected.

Source Error:



Line 5:
Line 6: Sub Page_Load()

Line 7: Dim client As New SmtpClient()

Line 8: client.Host = "localhost"

Line 9: client.Port = 25

Source File: c:\inetpub\wwwroot\smtpclient\SendMail.aspx Line: 7


Show Detailed Compiler Output:

C:\WINDOWS\system32>
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vbc .exe" /t:library
/utf8output
/R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__ b03f5f7f11d50a3a\System.Web.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0 __b77a5c561934e089\System.Xml.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\ 2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\T emporary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\assembly\dl3\4d e41090\1037aa00_40b8c601\smtpclient.DLL"
/R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseSer vices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseS ervices.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configurati on\2.0.0.0__b03f5f7f11d50a3a\System.Configuration. dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b7 7a5c561934e089\System.dll"
/R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0_ _b77a5c561934e089\System.Data.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Service s\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dl l"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0 .0.0__b03f5f7f11d50a3a\System.Drawing.dll"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\T emporary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\App_global.asax .5w9amsgm.dll"
/out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \Temporary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.dll" /D:DEBUG=1
/debug+ /define:_MYTYPE=\"Web\"
/imports:Microsoft.VisualBasic,System,System.Collec tions,System.Collections.Specialized,System.Config uration,System.Text,System.Text.RegularExpressions ,System.Web,System.Web.Caching,System.Web.SessionS tate,System.Web.Security,System.Web.Profile,System .Web.UI,System.Web.UI.WebControls,System.Web.UI.We bControls.WebParts,System.Web.UI.HtmlControls
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.0.vb"
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.1.vb"

Microsoft (R) Visual Basic Compiler version 8.0.50727.42

for Microsoft (R) .NET Framework version 2.0.50727.42

Copyright (c) Microsoft Corporation. All rights reserved.

c:\inetpub\wwwroot\smtpclient\SendMail.aspx(7) : error BC30182: Type
expected.

Dim client As New SmtpClient()

----End Paste----
I don''t have the smtp mail setup on that server, but when trying my other
form I changed the host and ports accordlingly where it should have used
the mail server. I even had tcpdump running on the port (running all this
through parallels) and nothing was sent. For some reason "SmtpClient"
just doesn''t work correctly. Is this because I have an older version of
Visual Studio (2002)? Should I consider upgrading to 2005? I have a
windows mobile 2005 PDA, which is the main reason why I would want to get
.net 2005 -- are there any other advantages?

Thanks for your help on this error, my start with .net is a little rough
so far, but I''m hoping to get better as I progress through this book. I
apologize ahead of time if this question is too "newbie like".

Thanks,

David



嗨大卫,


对于初学者来说,VS 2002是不可能的处理SmtpClient类

,因为它在.NET框架的那个版本中不存在。


但是,你确定问题是不是在那一章的web.config中?

我刚刚检查过,需要注释掉web.config的这一部分才能获得

要运行的页面:


< pages pageBaseType ="" />


您可能想看看作者的支持

网站是否有任何更正。


Ken

Microsoft MVP [ASP.NET]


< David Tholewrote in message

news:20 * ***************** @ News.GigaNews.Com ...
Hi David,

For starters, VS 2002 wouldn''t be able to deal with the SmtpClient class
because it doesn''t exist in that version of the .NET framework.

However, are you sure the problem isn''t in the web.config for that chapter?
I just checked and needed to comment out this part of the web.config to get
the page to run:

<pages pageBaseType="" />

You might want to see if there are any corrections in the author''s support
site.

Ken
Microsoft MVP [ASP.NET]

<David Tholewrote in message
news:20******************@News.GigaNews.Com...

嘿所有,


我仍​​然很新,但是我正在浏览ASP.net 2.0

释放的书,第一章并尝试编写我自己的小形式

电子邮件以获取乐趣。我尝试在书中使用他们的版本中的代码

到我最好的能力,并遇到了一些问题,大多数情况下,当尝试编译时,预计会出现类型

MS Visual Studio 2002.当我的

的东西根本不起作用时,我决定尝试使用他的代码几乎完全是
。我将它从CD复制到我的文件夹,然后只编辑了电子邮件

地址到我自己的地址,这样它就不会出现意外的情况。

它所使用的系统是Windows .net Server 2003 Standard。我得到的错误,

在运行页面时是:


---开始粘贴---


编译错误

描述:编译资源期间发生错误

为此请求提供服务。请查看以下具体的

错误详情并适当修改源代码。


编译器错误消息:BC30182:预期类型。


来源错误:



第5行:

第6行:Sub Page_Load()


第7行:昏暗的客户端为新的SmtpClient()


第8行:client.Host =" localhost"


第9行:client.Port = 25


源文件:c:\inetpub \wwwroot \ smtpclient \ SendMail.aspx行:7



显示详细的编译器输出:



C:\ WINDOWS \ system32>

" C:\ WINDOWS \ MicrosoftMosrosoft.NET \ Framework \v2.0.50727 \ vbc .exe" / t:library

/ utf8output

/R:"C:\WINDOWS\assembly\GAC_32\System.Web\.0.0.0.0__ b03f5f7f11d50a3a \ System.Web.dll"

/R:"C:\WINDOWS\assembly\GAC_MSIL \System.Xml \\\ 2.0.0.0 __b77a5c561934e089 \ System.Xml.dll" ;

/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\ 2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll"

/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \T emporary ASP.NET

Files \ smtpclient \ 8f865d90\1728c4ff\assembly\dl3\dd e41090\1037aa00_40b8c601\smtpclient.DLL"

/ R:" C:\ WINDOWS \assembly\GAC_32 \ System .EnterpriseSer vices \2.0.0.0__b03f5f7f11d50a3a \ System.EnterpriseS ervices.dll"

/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configurati on\ 2.0.0.0__b0 3f5f7f11d50a3a\System.Configuration。 dll

/R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b7 7a5c561934e089\System.dll"

/R:"C:\WINDOWS\assembly\GAC_32\System.Data\\\ 2.0.0.0_ _b77a5c561934e089\System.Data.dll"

/ R:" C :\ WINDOWS \assembly \ GAC_MSIL \System.Web.Service s \\\ 2.0.0.0__b03f5f7f11d50a3a \ System.Web.Services.dl l"

/ R:" C: \ WINDOWS \assembly\GAC_MSIL \System.Drawing \2.0 .0.0__b03f5f7f11d50a3a \ System.Drawing.dll"

/ R:" C:\ WINDOWS \ Microsoft。 NET\Framework\v2.0.50727 \T emporary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff\App_global.asax .5w9amsgm.dll"

/out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \Temporary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff \\ \\App_Web_nfetm-v4.dll& QUOT; / D:DEBUG = 1

/ debug + / define:_MYTYPE = \" Web \"

/imports:Microsoft.VisualBasic,System,System.Collec tions,System.Collections.Specialized,System.Config uration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.SessionS tate,System.Web.Security,System.Web。 Profile,System .Web.UI,System.Web.UI.WebControls,System.Web.UI.We bControls.WebParts,System.Web.UI.HtmlControls

" C:\ WINDOWS \\ \\ Microsoft /.NET \ Framework \v2.0.50727 \Tem porary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.0.vb"

" C:\ WINDOWS \ MicroStoswork \ Framework \v2.0.50727 \Tem porary ASP.NET

Files \ smtpclient\8f865d90\1728c4ff \ App_Web_nfetm-v4.1.vb"



Microsoft(R)Visual Basic编译器版本8.0.50727.42


for Microsoft(R).NET Framework版本2.0.50727.42


版权所有(c)Microsoft Corporation。保留所有权利。


c:\inetpub \wwwroot \ smtpclient \ SendMail.aspx(7):错误BC30182:输入

预期。


昏暗的客户端作为新的SmtpClient()



----结束粘贴----


我没有在该服务器上设置smtp邮件,但在尝试我的其他

表单时,我根据应该使用的地方更改了主机和端口

邮件服务器。我甚至在端口上运行tcpdump(通过parallels运行所有这些

)并且没有发送任何内容。由于某种原因,SmtpClient

只是无法正常工作。这是因为我有一个旧版本的

Visual Studio(2002)?我应该考虑升级到2005年吗?我有一个

windows mobile 2005 PDA,这是我想要获得的主要原因

.net 2005 - 还有其他任何优势吗?


感谢你对这个错误的帮助,我的.net开始有点粗糙

到目前为止,但我希望随着我的进展而变得更好书。如果这个问题过于新手喜欢,我会提前道歉。


谢谢,


大卫
Hey all,

I''m still very new at all this, but am going through the ASP.net 2.0
unleashed book, first chapter and trying to program my own little form
emailer for fun. I tried following the code for their version in the book
to the best of my abiltiies, and came across issues, mostly that a type
was expected when trying to compile in MS Visual Studio 2002. When my
stuff wasn''t working at all, I decided to try just using his code almost
exactly. I copied it from the CD to my folder, and edited just the e-mail
addresses to my very own so that it wasn''t going somewhere unexpected.
The system it''s on is Windows .net Server 2003 Standard. The error I got,
when running the page was:

---BEGIN PASTE---

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: BC30182: Type expected.

Source Error:



Line 5:
Line 6: Sub Page_Load()

Line 7: Dim client As New SmtpClient()

Line 8: client.Host = "localhost"

Line 9: client.Port = 25

Source File: c:\inetpub\wwwroot\smtpclient\SendMail.aspx Line: 7


Show Detailed Compiler Output:

C:\WINDOWS\system32>
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vbc .exe" /t:library
/utf8output
/R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__ b03f5f7f11d50a3a\System.Web.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0 __b77a5c561934e089\System.Xml.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\ 2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\T emporary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\assembly\dl3\4d e41090\1037aa00_40b8c601\smtpclient.DLL"
/R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseSer vices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseS ervices.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configurati on\2.0.0.0__b03f5f7f11d50a3a\System.Configuration. dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b7 7a5c561934e089\System.dll"
/R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0_ _b77a5c561934e089\System.Data.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Service s\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dl l"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0 .0.0__b03f5f7f11d50a3a\System.Drawing.dll"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\T emporary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\App_global.asax .5w9amsgm.dll"
/out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \Temporary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.dll" /D:DEBUG=1
/debug+ /define:_MYTYPE=\"Web\"
/imports:Microsoft.VisualBasic,System,System.Collec tions,System.Collections.Specialized,System.Config uration,System.Text,System.Text.RegularExpressions ,System.Web,System.Web.Caching,System.Web.SessionS tate,System.Web.Security,System.Web.Profile,System .Web.UI,System.Web.UI.WebControls,System.Web.UI.We bControls.WebParts,System.Web.UI.HtmlControls
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.0.vb"
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET
Files\smtpclient\8f865d90\1728c4ff\App_Web_nfetm-v4.1.vb"

Microsoft (R) Visual Basic Compiler version 8.0.50727.42

for Microsoft (R) .NET Framework version 2.0.50727.42

Copyright (c) Microsoft Corporation. All rights reserved.

c:\inetpub\wwwroot\smtpclient\SendMail.aspx(7) : error BC30182: Type
expected.

Dim client As New SmtpClient()

----End Paste----
I don''t have the smtp mail setup on that server, but when trying my other
form I changed the host and ports accordlingly where it should have used
the mail server. I even had tcpdump running on the port (running all this
through parallels) and nothing was sent. For some reason "SmtpClient"
just doesn''t work correctly. Is this because I have an older version of
Visual Studio (2002)? Should I consider upgrading to 2005? I have a
windows mobile 2005 PDA, which is the main reason why I would want to get
.net 2005 -- are there any other advantages?

Thanks for your help on this error, my start with .net is a little rough
so far, but I''m hoping to get better as I progress through this book. I
apologize ahead of time if this question is too "newbie like".

Thanks,

David



感谢您的帮助,我检查了我的配置文件并没有找到

奇怪的是什么关于它真的。我现在的配置文件是:


--- BEGIN SNIP ---

<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>


< configuration>


< system.web>


< ; - 动态调试编译


设置编译debug =" true"在编译页面中插入调试符号

(.pdb信息)


。因为这会创建一个更大的文件

更慢地执行
,所以只有当

调试时才应将此值设置为true


其他时间都是假的。有关更多信息,请参阅

文档,了解


调试ASP.NET文件。


- > ;


< compilation defaultLanguage =" vb"调试= QUOT;真" />


<! - 自定义错误消息


设置customErrors mode =" On"或者RemoteOnly或RemoteOnly。启用自定义

错误消息,关闭禁用。


为你想要处理的每个错误添加< errortags。


- >


< customErrors mode =" RemoteOnly" />


<! - AUTHENTICATION


此部分设置

应用程序的身份验证策略。可能的模式是Windows,


" Forms"," Passport"和无


- >


< authentication mode =" Windows" />


<! - 授权


此部分设置

申请的授权政策。您可以允许或拒绝用户或角色访问应用程序资源的
。通配符:*意思是

每个人,?意味着匿名


(未经身份验证的)用户。


- >


< authorization> ;


< allow users =" *" /<! - 允许所有用户 - >


<! - < allow users =" [逗号分隔的用户列表]"


roles =" [逗号分隔的角色列表]" />


< deny users =" [逗号分隔的用户列表]


roles =" [逗号分隔的角色列表]" />


- >


< / authorization>


<! - 应用程序级别跟踪记录


应用程序级别跟踪为应用程序中的每个

页面启用跟踪日志输出。


设置跟踪启用=" true"启用应用程序跟踪日志记录。

如果pageOutput =" true",


跟踪信息将显示在每个底部

页面。否则,您可以通过浏览trace.axd来查看


应用程序跟踪日志。页面来自

您的网络应用程序


root。


- >

< trace enabled =" false" requestLimit = QUOT; 10" pageOutput =" false"

traceMode =" SortByTime"设置LocalOnly ="真" />


<! - 会话状态设置


默认情况下,ASP.NET使用cookie来识别哪些请求

属于特定会话。


如果cookie不可用,可以通过向URL添加会话标识符来跟踪会话。



要禁用cookie,请设置sessionState cookieless =" true"


- >


< sessionState mode =" InProc"

stateConnectionString =" tcpip = 127.0.0.1:42424" sqlConnectionString =" data

source = 127.0.0.1; user id = sa; password =" Cookie的= QUOT假QUOT; timeout =" 20"

/>


<! - 全球化


本节设置应用程序的全球化设置。


- >


< globalization requestEncoding =" utf-8"的ResponseEncoding = QUOT; UTF-8英寸/>


< /system.web>


< / configuration>

--- END SNIP ---


我正在使用他的代码编写本章,它是:


--- BEGIN SNIP- -


<%@ Page Language =" VB" %>


<%@ Import Namespace =" System.Net.Mail" %>


<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Transitional // EN"

" http:/ /www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


< script runat =" server">


Sub Page_Load()

Dim client As New SmtpClient()

client.Host =" localhost" < br $> b $ b client.Port = 25

client.Send(" XX*@YYY.com"," AA*@BBB.com" ;,_


让我们吃午饭!,在牛排馆享用午餐?


结束子


< / script>


< html xmlns =" http://www.w3.org/1999/ XHTML" >


< head id =" Head1" runat =" server">


< title>发送邮件< / title>


< / head>


< body>


< form id =" form1" runat =" server">


< div>


发送电子邮件!


< / div>


< / form>


< / body>


< / html>


--- END SNIP ---


基本上他的代码与书中的相同, XXX,YYY,AAA,BBB

只是替换了我的电子邮件地址。


我需要做些什么来web.config来制作这项工作?我是b $ b进入iis,然后去了网站,它说我正在使用的ASP.net

版本是2.0.50727


再次感谢您的帮助。我认为有更多的理由让我升级到VS 2005(或者是2006年即将推出,我应该等待b
)也许只是为了学习而获得快报版本?)


-David

Thanks for the help, I checked my configuration file and didn''t find
anything odd about it really. My configuration file right now is:

---BEGIN SNIP---
<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<system.web>

<!-- DYNAMIC DEBUG COMPILATION

Set compilation debug="true" to insert debugging symbols
(.pdb information)

into the compiled page. Because this creates a larger file
that executes

more slowly, you should set this value to true only when
debugging and to

false at all other times. For more information, refer to the
documentation about

debugging ASP.NET files.

-->

<compilation defaultLanguage="vb" debug="true" />

<!-- CUSTOM ERROR MESSAGES

Set customErrors mode="On" or "RemoteOnly" to enable custom
error messages, "Off" to disable.

Add <errortags for each of the errors you want to handle.

-->

<customErrors mode="RemoteOnly" />

<!-- AUTHENTICATION

This section sets the authentication policies of the
application. Possible modes are "Windows",

"Forms", "Passport" and "None"

-->

<authentication mode="Windows" />

<!-- AUTHORIZATION

This section sets the authorization policies of the
application. You can allow or deny access

to application resources by user or role. Wildcards: "*" mean
everyone, "?" means anonymous

(unauthenticated) users.

-->

<authorization>

<allow users="*" /<!-- Allow all users -->

<!-- <allow users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

<deny users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

-->

</authorization>

<!-- APPLICATION-LEVEL TRACE LOGGING

Application-level tracing enables trace log output for every
page within an application.

Set trace enabled="true" to enable application trace logging.
If pageOutput="true", the

trace information will be displayed at the bottom of each
page. Otherwise, you can view the

application trace log by browsing the "trace.axd" page from
your web application

root.

-->

<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />

<!-- SESSION STATE SETTINGS

By default ASP.NET uses cookies to identify which requests
belong to a particular session.

If cookies are not available, a session can be tracked by
adding a session identifier to the URL.

To disable cookies, set sessionState cookieless="true".

-->

<sessionState mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="20"
/>

<!-- GLOBALIZATION

This section sets the globalization settings of the application.

-->

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

</system.web>

</configuration>
---END SNIP---

I''m using his code kinda for the chapter, it is:

---BEGIN SNIP---

<%@ Page Language="VB" %>

<%@ Import Namespace="System.Net.Mail" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Sub Page_Load()

Dim client As New SmtpClient()

client.Host = "localhost"

client.Port = 25

client.Send("XX*@YYY.com", "AA*@BBB.com", _

"Let''s eat lunch!", "Lunch at the Steak House?")

End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head id="Head1" runat="server">

<title>Send Mail</title>

</head>

<body>

<form id="form1" runat="server">

<div>

Email sent!

</div>

</form>

</body>

</html>

--- END SNIP---

Basically his code is the same as in the book, the XXX, YYY, AAA, BBB
just substituted for my e-mail addresses.

Was there something I needed to do to web.config to make this work? I
went into iis, and went to the site, and it says that the ASP.net
version I''m using is 2.0.50727

Thanks for the help again on this. I think there are more reasons for
me to upgrade to VS 2005 (or is 2006 coming out soon that I should
wait, and maybe get the express edition just for learning?)

-David


这篇关于SMTPClient的奇怪问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆