繁体   English   中英

在Visual Studio 2012中进行调试时将IIS Express更改为全功能IIS

[英]Change IIS Express to full functions IIS when debug in Visual Studio 2012

在ASP.NET Unleashed书(SAMS Publishing, http : //www.informit.com/store/asp.net-4-unleashed-9780672331121 ISBN-10:0-13-256581-1)中有一个代码段:File: SendMail .aspx

<%@ Page Language="C#" %>

<%@ 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">
    void Page_Load()
    {
        SmtpClient client = new SmtpClient();
        client.Host = "localhost";
        client.Port = 25;
        client.Send("nate@somewhere", "nate@exclaimcomputing.com",
        "Beware!", "Watch out for zombies!");
    }
</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>

本书警告: “ ...通过使用本地SMTP服务器发送电子邮件。如果未启用SMTP服务器,则会收到错误消息:远程主机强行关闭了现有连接。您可以通过以下方式启用本地SMTP服务器: Internet信息服务,用鼠标右键单击默认SMTP虚拟服务器,然后选择开始。”

通过使用Visual Sutio 2012(包括内置IIS Express),我无法练习此代码,因为IIS Express不支持SMTP。

请帮助我将IIS Express更改为全功能IIS,以在以下代码片段中进行练习。

IIS Express是家庭/家庭版的版本,不是专业/最终版。 如果没有Windows Pro / Ultimate,则可以安装自己的SMTP服务器,网络上有很多免费的优质服务器。

但是,如果您不想浪费时间安装/配置SMTP服务器来测试电子邮件,则可以直接从.Net Framework发送电子邮件。

好。 因此,您 .Net 之后安装了IIS,因此请确保已运行aspnet_regiis.exe

现在,右键单击您的项目,选择属性,然后按照Microsoft的说明进行操作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM