2013-06-28 7 views
7

में SmtpClient का उपयोग करते समय अपवाद मुझे Azure वेब या वर्कर भूमिका में SmtpClient का उपयोग करते समय अपवाद मिल रहा है।"अनुरोधित फ़ंक्शन समर्थित नहीं है" Azure भूमिका

मैं मैन्युअल रूप से पुन: पेश करने आरडीपी के माध्यम से भूमिका VMs पर चलने के लिए एक सांत्वना एप्लिकेशन बनाया:

using System; 
using System.Net; 
using System.Net.Mail; 
using System.Text; 

namespace ConsoleApplication1 
{ 
    class Program 
    { 
     static void Main() 
     { 
     var mailClient = new SmtpClient("mail.redacted.com", 587); 
     mailClient.EnableSsl = true; 
     mailClient.DeliveryFormat = SmtpDeliveryFormat.International; 
     mailClient.DeliveryMethod = SmtpDeliveryMethod.Network; 

     mailClient.UseDefaultCredentials = false;//SET THIS FIRST OR IT WIPES OUT CREDENTIALS 
     NetworkCredential netCreds = new NetworkCredential("[email protected]", "12345 same combination on my luggage"); 
     mailClient.Credentials = netCreds; 

     MailMessage message = new MailMessage(); 
     message.SubjectEncoding = Encoding.UTF8; 
     message.BodyEncoding = Encoding.UTF8; 
     message.IsBodyHtml = false; 

     message.From = new MailAddress("[email protected]"); 
     message.To.Add(new MailAddress("[email protected]")); 

     message.Subject = "testing " + DateTime.UtcNow; 
     message.Body = "The quick brown fox jumped over the lazy dogs."; 

     mailClient.Send(message); 
     } 
    } 
} 

स्थानीय रूप से यह एक ई ठीक भेजता है।

 
    Unhandled Exception: System.Net.Mail.SmtpException: Failure sending mail. ---> System.ComponentModel.Win32Exception: The function requested is not supported 
     at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean throwOnError, SecurityStatus& statusCode) 
     at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob) 
     at System.Net.Mail.SmtpNtlmAuthenticationModule.Authenticate(String challenge, NetworkCredential credential, Object sessionCookie, String spn, ChannelBinding channelBindingToken) 
     at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) 
     at System.Net.Mail.SmtpClient.Send(MailMessage message) 
     --- End of inner exception stack trace --- 
     at System.Net.Mail.SmtpClient.Send(MailMessage message) 
     at ConsoleApplication1.Program.Main() in c:\development\ConsoleApplication1\ConsoleApplication1\Program.cs:line 39 

मैंने पुष्टि की है कि Azure मशीनों आरडीपी के माध्यम से Azure भूमिकाओं पर TCPing.exe चलाकर मेल सर्वर पर पोर्ट 587 का उपयोग कर सकते हैं: Azure पर मैं इस मिलता है।

उत्तर

5

तो स्पष्ट रूप से समस्या सर्वर के बीच एक बेमेल एनटीएलएम संस्करण था।

Azure भूमिकाओं में प्रवेश करके और सेटिंग को अक्षम करने के बाद ग्राहकों के लिए "NTLMv2 सुरक्षा की आवश्यकता होती है", तो यह काम किया:

enter image description here

(this answer और प्रेरणा के लिए this answer के लिए धन्यवाद।)

वर्तमान में यह देखते हुए कि क्या हम अपने एसएमटीपी सर्वर को एनटीएलएमवी 2-संगत होने के लिए अपग्रेड कर सकते हैं। अन्यथा हमें कुछ स्वचालित कोड सेट अप करना होगा ताकि प्रत्येक जेनरेटेड रोल इंस्टेंस पर सेटिंग को अक्षम किया जा सके।

स्पष्ट रूप से यह कोड पिछले महीने काम करता था। तो मैं अनुमान लगा रहा हूं कि हाल ही में एज़ूर ओएस अपग्रेड ने डिफ़ॉल्ट सेटिंग्स बदल दी हैं। [\ CurrentControlSet \ Control \ Lsa \ MSV1_0 HKEY_LOCAL_MACHINE \ SYSTEM] इस सेटिंग के लिए रजिस्ट्री कुंजी

है "NtlmMinClientSec" = DWORD:

FYI करें 20000000

की स्थापना को स्वचालित करने के रजिस्ट्री कुंजी add a startup task इस तरह एक reg add आदेश युक्त

reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0^
/v NtlmMinClientSec^
/t REG_DWORD^
/d 0x20000000^
/f 

जहां /f वर्तमान सेटिंग को ओवरराइट करने के लिए मजबूर करता है और ^ बेहतर पठनीयता के लिए कमांड को एकाधिक लाइनों में तोड़ने की अनुमति देता है। issues during role startup को रोकने के लिए ASCII एन्कोडिंग में कमांड को सहेजना सुनिश्चित करें।

संबंधित मुद्दे