एक नीला आभासी मशीन में से अमान्य के रूप में सत्यापित किया गया था, मैं एक वेब अनुप्रयोग और FormsAuthentication के साथ सब वेब अनुप्रयोग और HTTPS कोई मान्य प्रमाणपत्र के साथ विन्यस्त है। प्रमाणीकरण एक ही मशीन कुंजी के साथ मुख्य अनुप्रयोग और उप अनुप्रयोग के बीच साझा किया जाता है। एसएसएल दो अनुप्रयोगों पर आवश्यक हैरिमोट प्रमाणपत्र उपयोगकर्ता
यह सब सार्वजनिक यूआरएल के बाहर से ठीक है।
मैं विन्यास उद्देश्य (उप आवेदन किसी अन्य सर्वर पर स्थापित किया जा सकता है) के लिए सार्वजनिक नाम के साथ उप आवेदन करने के लिए मुख्य आवेदन से कुछ अनुरोध भेजने के लिए की जरूरत है। ये अनुरोध पहचान के लिए एक विशिष्ट खाते का उपयोग करते हैं।
// If we are not authenticated
if(!isAuthenticated)
{
// Check user and login
if(!User.Check(this.WebApiLogin, this.WebApiPassword))
throw new Exception("Unauthorized user");
isAuthenticated = true;
}
// Convert HttpCookie to Cookies
var cookies = FormsAuthentication.GetAuthCookie(this.WebApiLogin, false).ToCookies();
// Create request with the authentication cookie
Uri baseAddress = new Uri(this.WebApiUrl);
CookieContainer cookieContainer = new CookieContainer();
foreach(var cookie in cookies)
{
if(String.IsNullOrEmpty(cookie.Domain))
cookie.Domain = baseAddress.Host;
if(baseAddress.Scheme == "https")
cookie.HttpOnly = false;
cookieContainer.Add(cookie);
}
// send request
using(HttpClientHandler handler = new HttpClientHandler() { CookieContainer = cookieContainer })
{
using(HttpClient client = new HttpClient(handler))
{
client.BaseAddress = baseAddress;
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
return client.GetStringAsync(requestUri).Result;
}
}
सभी यह ssl बिना ठीक है:
यह मेरा कोड उप आवेदन करने के लिए मुख्य आवेदन से अनुरोध भेजने के लिए है, this.WebApiUrl सार्वजनिक url है। जब मैं सक्रिय ssl, मुख्य आवेदन और उप डोमेन आवेदन के बीच अनुरोध
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel..
यहाँ के साथ विफल System.Net और System.Net सॉकेट से सिस्टम लॉग है।
System.Net Information: 0 : [10788] SecureChannel#92992 - Remote certificate was verified as invalid by the user.
System.Net.Sockets Verbose: 0 : [10788] Socket#29502801::Dispose()
System.Net Error: 0 : [10788] Exception in HttpWebRequest#61435094:: - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel..
System.Net Verbose: 0 : [10788] HttpWebRequest#61435094::EndGetResponse()
System.Net Error: 0 : [10788] Exception in HttpWebRequest#61435094::EndGetResponse - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel..
क्या अजीब बात है यह लॉग कहना नहीं है क्यों के रूप में उपयोगकर्ता द्वारा अमान्य प्रमाणपत्र सत्यापित किया गया है। althougth यह प्रमाण पत्र बाहर से अनुरोध के लिए मान्य है।
महत्वपूर्ण: मैं ServicePointManager.ServerCertificateValidationCallback के साथ एक समाधान नहीं करना चाहते हैं, क्योंकि यह
धन्यवाद उत्पादन परिवेश में है तुम्हारी मदद के लिए
हाँ, हम इस कॉलबैक और जल्दी वापसी 'अगर (त्रुटि == SslPolicyErrors.None साथ एक ही सर्वर पर किसी अन्य वेब एप्लिकेशन है) सच वापसी; '। मैंने कॉलबैक के बिना भी कोशिश की और मेरे पास हमेशा मेरे ऐप और मेरे उप ऐप के बीच अनुरोधों की त्रुटि है। – Troopers
क्या कॉलबैक में 'त्रुटि' का मान कुछ और उपयोगी साबित करता है? मुझे लगता है कि आपने अपने रूट प्रमाणपत्रों के माध्यम से waded किया है: http://blogs.msdn.com/b/jpsanders/archive/2009/09/16/troubleshooting-asp-net-the-remote-certificate-is-invalid -according-to-the-validation-process.aspx – nullPainter
हां, मैंने प्रमाण पत्र, प्रमाणपत्र पथ, प्रमाणपत्र प्राधिकरण की जांच की है .. यह ठीक है। और मुझे नहीं लगता कि समस्या प्रमाण पत्र है क्योंकि बाहर से अनुरोध ठीक हैं। यह केवल मुख्य एप्लिकेशन और असफल होने वाले उप-अनुप्रयोग के बीच अनुरोध है – Troopers