[Mono-list] Problem with mono WCF (compatibility with .NET ??)

Jspoon wasolic at gmail.com
Tue Apr 27 05:32:08 EDT 2010


Hi, thank you for your answer.

>>If there are not allowed characters in XML, then it will be raised. But 
>>there are couple of other chances that it's not receiving expected XMLs. 
>>For example, some people use BinaryMessageEncodingBindingElement with 
>>HttpTransportBindingElement, which might bring wrong (unexpected) binary 
>>format error.
>>Can you post the actual code that reproduces your problem?

There is my service model configuration. I use default basicHttpBinding
<system.serviceModel>

        <behaviors>
            <serviceBehaviors>
                <behavior name="bAuthentication">
					<serviceMetadata httpGetEnabled="true" httpGetUrl="wsdl" />
					<serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>

        <services>
            <service behaviorConfiguration="bAuthentication" 
	                
name="WASOLIC.ServiceLogic.AuthenticationService.Authentication">
                <endpoint address="" binding="basicHttpBinding"
                             
contract="WASOLIC.ServiceLogic.AuthenticationService.IAuthenticationService"/>
            </service>			
        </services>

    </system.serviceModel>

In my wcf operations I return this data contract (wrap data as Result and
Error):
[DataContract]
    public class ServiceReturnValueWrapper<T>
    {
        [DataMember]
        public ServiceData<T> Result { get; set; }

        [DataMember]
        public WasolicException Error { get; set; }
    }

where ServiceData<T> is generic type (because I return from different
function different result):
[DataContract]
    public class ServiceData<T>
    {
        [DataMember]
        public T Data { get; set; }
    }

If error occured, it is after call this function (error occured 3 times from
5):
public ServiceReturnValueWrapper<SecurityToken> IssueNewSecurityToken()
        {
            return new ServiceReturnValueWrapper<SecurityToken>
            {
                Result = new ServiceData<SecurityToken>
                {
                    Data = new SecurityToken
                    {
                        Identity = new Identity()
                        {
                            UserName = string.Empty,
                            PasswordHash = string.Empty,
                            PasswordSalt =
Encoding.ASCII.GetString(Hash.GetSalt(5)),
                            IsAuthenticated = false,
                            Roles = new List<string>(),
                            Profile = -1,

                            DateCreated = DateTime.Now,
                            DateLastUpdate = DateTime.Now
                        }
                    }
                },

                Error = null
            };
        }
Security token contains Identity which contains data member above in code.

I think that problem is with PasswordSalt in Identity.  Because error
occured sometimes (3 times from 5) because Salt is random generated -
sometimes generated chars which is ok for wcf, but sometimes it is no ok.
Generating salt is from this function:

public static byte[] GetSalt(int _size)
        {
            byte[] saltBytes = new byte[_size];

            RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();

            rng.GetNonZeroBytes(saltBytes);

            return saltBytes;
        }


>>And it'd be a lot nicer if you try mono from trunk instead of old 2.6.3.

How can I simply get trunk version for Windows? And how install it?
-- 
View this message in context: http://mono.1490590.n4.nabble.com/Problem-with-mono-WCF-compatibility-with-NET-tp2065368p2067279.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list