[Mono-bugs] [Bug 573326] New: WCF call in MonoTouch fails when BasicHttpSecurityMode is set to TransportWithMessageCredential

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jan 23 20:54:56 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=573326

http://bugzilla.novell.com/show_bug.cgi?id=573326#c0


           Summary: WCF call in MonoTouch fails when BasicHttpSecurityMode
                    is set to TransportWithMessageCredential
    Classification: Mono
           Product: MonoTouch
           Version: unspecified
          Platform: Macintosh
        OS/Version: Other
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: kevin.boucher at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer
           Blocker: Yes


Description of Problem:

I have a WCF service that is using basic http with
TransportWithMessageCredential.  

When I run it in MonoTouch I get the following BeginWrite failure:

Exception in async operation: System.Net.WebException: Error writing request:
BeginWrite failure
  at System.Net.WebConnectionStream.WriteHeaders () [0x00050] in
/Developer/MonoTouch/Source/mcs/class/System/System.Net/WebConnectionStream.cs:654 
  at System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer) [0x00093]
in
/Developer/MonoTouch/Source/mcs/class/System/System.Net/WebConnectionStream.cs:622 
  at System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error)
[0x00169] in
/Developer/MonoTouch/Source/mcs/class/System/System.Net/HttpWebRequest.cs:1124 



Steps to reproduce the problem:
1.  Create a WCF service that uses TransportWithMessageCredential 
2.  Make sure you are using SSL
I don't have a valid cert (which may be an issue) but I ran this:

makecert.exe -r -pe -ss Root -sr LocalMachine -n "CN=magichat9" -sky exchange

Grab thumbprint from cert in certmgr and remove spaces
0bf002e39f7d67f7f02f49100c607294747d5260

Generate GUID
{1DBFF2C5-4263-4646-94E2-FAC1BBD2318A}

Add the SSL certificate:
                netsh http add sslcert ipport=0.0.0.0:8002 certstore=Root
certhash=0bf002e39f7d67f7f02f49100c607294747d5260
appid={6C01896A-9FD6-421e-8489-4F576627DCA2}

Add the URL ACL
                "add urlacl url=http://+:8002/AccountService
sddl=D:(A;;GXGR;;;AU)


3.  Now try to call it from MonoTouch...  My client code looks like this:

                        // MonoTouch does not support System.Configuration  
            BasicHttpBinding binding = new
BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
            EndpointAddress endpoint = new EndpointAddress(new
Uri("https://myserver:8002/AccountService"));
                    AccountServiceClient client = new
AccountServiceClient(binding, endpoint);
            client.ClientCredentials.UserName.UserName = "su";
            client.ClientCredentials.UserName.Password = "protect the inocent";

            // Subscribe to the completed event for the invocation you want to
make  
                        client.LoadAccountCompleted += delegate(object sender1,
LoadAccountCompletedEventArgs e1) {
                                @@ // this next line is where I die            
                                 Console.WriteLine (e1.Result);  

                _mainTabs.LoadSummary();

                _mainTabs.View.Hidden = false;
                window.BringSubviewToFront(_mainTabs.View);
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible
= false;
            }; 

            // Invoke the service 
            AccountIdentifier acc = new AccountIdentifier();
            acc.m_AccountID = Context.AccountId;
            client.LoadAccountAsync(acc, System.DateTime.Now);



Actual Results:

Exception in async operation: System.Net.WebException: Error writing request:
BeginWrite failure
  at System.Net.WebConnectionStream.WriteHeaders () [0x00050] in
/Developer/MonoTouch/Source/mcs/class/System/System.Net/WebConnectionStream.cs:654 
  at System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer) [0x00093]
in
/Developer/MonoTouch/Source/mcs/class/System/System.Net/WebConnectionStream.cs:622 
  at System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error)
[0x00169] in
/Developer/MonoTouch/Source/mcs/class/System/System.Net/HttpWebRequest.cs:1124 


Expected Results:

Serivce works

How often does this happen? 

Every time

Additional Information:

I am wondering if it is the cert not being valid... but code like this on the
client doesn't work:

client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode
= System.ServiceModel.Security.X509CertificateValidationMode.None;

               
client.ClientCredentials.ServiceCertificate.Authentication.RevocationMode =
System.Security.Cryptography.X509Certificates.X509RevocationMode.NoCheck;

Hope someone can help...!  thanks...

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list