모든 것이 좋지만 web.config가이 이상한 오류를 표시합니다.web.config 구성 오류
web.config의 문자열 목록이 양호 할 경우 어떻게해야합니까?
에러 :
구성 오류 설명 : 오류가이 요청을 제공하는 데 필요한 구성 파일을 처리하는 동안 일어났다. 아래의 특정 오류 세부 정보를 검토하고 구성 파일을 적절히 수정하십시오.
Parser Error Message: Unrecognized configuration section stringlist.
Source Error:
Line 6: <connectionStrings/>
Line 7:
Line 8: <stringlist key="SmtpServers">
Line 9: <stringlistItem value="smtp.transip.nl" />
Line 10: <stringlistItem value="localhost" />
Source File: C:\local\vCardGenerator.Website\vCardGenerator.Website\web.config Line: 8
의 Web.config :
<stringlist key="SmtpServers">
<stringlistItem value="smtp.transip.nl" />
<stringlistItem value="localhost" />
</stringlist>
등급 :
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Configuration;
using System.Net.Mail;
using System.Net.Configuration;
using Compulutions.Net;
using Compulutions.Web;
using System.IO;
using System.Web.Mail;
using System.Collections.Generic;
using System.ComponentModel;
using System.Web.Services.Description;
// System.Web.Mail.SmtpMail.SmtpServer
// using System.Web.Mail.SmtpClient;
namespace vCardGenerator.Website.Masterpage
{
public class SendvCard
{ //
public void MailvCard(string recipient, string filename)
{
Mailer smtp = new Mailer("smtpServers");
/* SMTP - port 25 */
smtp.AddAttachment(filename); //.vcf file Path
smtp.FromAddress = new MailAddress("[email protected]");
smtp.Subject = "vCard";
smtp.MailBody = "There is a vCard waiting for you in the attachment!";
smtp.AddRecipient(recipient);
#if !DEBUG
try
{
#endif
smtp.SendMail();
#if !DEBUG
}
catch (Exception ex)
{
Response.Write("Exception Occured: " + ex);
//Responds.Write("Sending vCard Failed, Please try again!")
}
#endif
}
}
}
비슷한 질문은 내 설명에 적합하지 않습니다. 나는 SendvCard.cs의 인스턴스를 생성하고 클래스 (MailvCard)의 전송 방식 자체 aspx.cs
호출 한 :
// Calls the method at the class
smtp.MailvCard("[email protected]", "C:\\local\\vCardGenerator.Website" + "\\" + "FirstName_LastName" + ".vcf");
}
다른/더 많은 정보를 제공 할 의사가 필요한 경우 .
감사
'stringlist'와'stringlistitem'은 무엇입니까? 이것들을 유효한 설정 섹션으로 만들거나 등록 했습니까? –
configSections 노드에 stringlist를 추가하는 것을 잊었습니까? –
예, 유효한 구성 섹션으로 등록했습니다. – Lobato