我无法通过 ASP.NET 发送电子邮件,并向我的网络主机发送了一封电子邮件寻求帮助,并被告知修改我的安全设置,并收到了一个链接:
http://forums.asp.net/t/1111145.aspx/1
我已阅读其中所说的内容并尝试设置
,但随后出现错误:
此配置节不能在此路径中使用。当站点管理员使用 锁定对此部分的访问时,会发生这种情况。来自继承的配置文件。
我没有设置任何其他 web.config 文件。
所以我再次询问网络主机,并询问这是否是我无法更改的服务器设置,但我得到的答复只是:
您需要指定更具体的路径。
这很可爱,但我不知道这意味着什么!
做了更多的挖掘后,我想知道是否必须设置一个单独的 trust
文件,这是正确的吗?
有人可以指出我设置信任级别的正确方法吗(我意识到“完全”也可能是不正确的?),因为我真的不明白我应该做什么!
I can't send email via ASP.NET and sent an email to my web hosts for some help and was told to modify my security settings and was sent a link:
http://forums.asp.net/t/1111145.aspx/1
I've read what it said there and tried setting <trust level="Full" originUrl="" />
in web.config, but then I get the error:
This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.
I've not set any other web.config file.
So I asked the web hosts again, and asked if it was a server setting which I cannot change, but the response I got was just:
You'll need to specify a more specific path.
Which is lovely, but I've no idea what that means!
Having done a bit more digging I am wondering if I have to set up a separate trust
file, is this correct?
Could someone point me in the direction of the correct way to set up my Trust level (I realise "full" is probably incorrect as well?) as I really don't understand what I am supposed to do!
发布评论
评论(2)
信任级别记录如下:http://msdn.microsoft.com/ en-us/library/ie/wyts434y.aspx。在共享主机中,提供商会锁定该设置,因此您无法更改 web.config。如果您明确要求提供商允许完全信任您的应用程序,并且他们回答“嗯?”,那么您正在与一个未受过教育的人交谈 - 要么请求升级,要么更改主机。 “请以完全信任的方式配置我的应用程序”应该足够清楚了。请注意,一旦他们理解了您的请求,他们可能就不愿意这样做。
另外,我不能确定发送邮件是否需要完全信任。发送邮件涉及与 SMTP 服务器通信的能力,通常 Web 主机只允许访问他们的服务器,并阻止其他所有内容(为了防止垃圾邮件)。您将无法说服他们为您破例,但如果您询问“请告诉我使用哪个 smtp 和端口从我的 ASP.NET 应用程序发送电子邮件”,他们应该将其提供给您(否则,升级或更改主机)。实际上,在您得出信任级别是阻碍邮件发送的结论之前,您实际上应该先要求他们帮助您发送邮件(现在,我很确定它不会)。
另外,请阅读此内容:https://meta.stackexchange.com/questions/66377 /xy 问题是什么
Trust levels are documented here: http://msdn.microsoft.com/en-us/library/ie/wyts434y.aspx. In shared hosting, providers lock that settings, so you cannot change in your web.config. If you clearly requested from your provider to allow full trust to your application, and if they responded with "huh?", then you were talking to an uneducated person - either request escalation or change hosts. "Please configure my application with full trust" should be clear enough. Note that they may not be willing to do that, once they understand your request.
Also, I cannot be sure that full trust is required to send mail out. Sending mail out involves ability to communicate to an SMTP server, and usually web hosts allow accessing only theirs and they block everything else (for spam prevention). You will not be able to talk them into making an exception for you, but if you ask "please tell me which smtp and port to use to send email out from my asp.net application", they should give it to you (otherwise, escalate or change hosts). You actually should have asked them to help you send mail out first, before you made conclusion that trust-level is what's obstructing it (now, I'm pretty sure it doesn't).
Also, read this, please: https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
试试这个:
Try this: