Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - Service crashing!!

 
 
Old 11-19-2007   #1 (permalink)
DEE


 
 

Service crashing!!

Hi There,



The Service interface ,datacontracts ,configs are as below:



[ServiceContract]

public interface IService1

{

[OperationContract] CompositeType GetData(string name);

[OperationContract] CompositeType
GetDataUsingDataContract(CompositeType composite);

}

[DataContract]

public class CompositeType

{

[DataMember]public string name;

[DataMember]public IEnumerable<Property> properties;

}

[DataContract]

public class Property

{

[DataMember] public string Name;

[DataMember] public object Value;

}



Service implemention is as below :



public class Service1 : IService1

{

public CompositeType GetData(string name)

{

List<Property> lstProperty = new List<Property>();

lstProperty.Add(new Property { Name = "name", Value = "name1" });

lstProperty.Add(new Property { Name = "description", Value =
"description" });

lstProperty.Add(new Property { Name = "createddate", Value =
"createddate" });

lstProperty.Add(new Property { Name = "modifieddate", Value =
"modifieddate;" });

return new CompositeType { name = "comp1", properties =
lstProperty.ToArray() };

}





public CompositeType GetDataUsingDataContract(CompositeType composite)

{

throw new NotImplementedException();

}

}



Server Config:



<system.serviceModel>

<services>

<service behaviorConfiguration="WCFService1.Service1Behavior"

name="WCFService1.Service1">

<endpoint address="" binding="wsHttpBinding" bindingConfiguration=""

contract="WCFService1.IService1" />

<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />

</service>

</services>

<behaviors>

<serviceBehaviors>

<behavior name="WCFService1.Service1Behavior">

<!-- To avoid disclosing metadata information, set the value below to
false and remove the metadata endpoint above before deployment -->

<serviceMetadata httpGetEnabled="true"/>

<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment to avoid
disclosing exception information -->

<serviceDebug includeExceptionDetailInFaults="false"/>

</behavior>

</serviceBehaviors>

</behaviors>

</system.serviceModel>





my client config looks like this:



<system.serviceModel>

<bindings>

<wsHttpBinding>

<binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"

openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00"

bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"

maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"

allowCookies="false">

<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"

maxBytesPerRead="4096" maxNameTableCharCount="16384" />

<reliableSession ordered="true" inactivityTimeout="00:10:00"

enabled="false" />

<security mode="Message">

<transport clientCredentialType="Windows" proxyCredentialType="None"

realm="" />

<message clientCredentialType="Windows"
negotiateServiceCredential="true"

algorithmSuite="Default" establishSecurityContext="true" />

</security>

</binding>

</wsHttpBinding>

</bindings>

<client>

<endpoint address="http://localhost:3841/Service1.svc"
binding="wsHttpBinding"

bindingConfiguration="WSHttpBinding_IService1"
contract="ServiceReference.IService1"

name="WSHttpBinding_IService1">

<identity>

<userPrincipalName value="shivakd@xxxxxx" />

</identity>

</endpoint>

</client>

</system.serviceModel>





my Client Code:



Service1Client client = new Service1Client();

CompositeType comp = client.GetData("name");

Console.WriteLine("comp.name");

Console.ReadKey();



The Problem:



The composite type contains IEnumarable<Property> ,now if we call
GetData on the client proxy ,which is suppose to return
CompositeType , the Service will just exits ,without sending the
response message.



could any one throw some light on this.



Thanks and Regards

Dee

My System SpecsSystem Spec
Old 11-19-2007   #2 (permalink)
Chris Mullins [MVP - C#]


 
 

Re: Service crashing!!

I don't think the value side of CompositeType can actually be IEnumerable. I
could well, be wrong there but I would try turing it into:
public class CompositeType
{
[DataMember]public string name;
[DataMember]public List<Property> properties;
}

.... and see what happens. The List, of course, will just be turned into an
array of Property as it crosses the wire (as defined by the WSDL) but the
client side proxy should be smart enough to turn it back into a Generic
List.

The service is only crashing because you don't have an exception handler
around the GetData call. Wrap the server side "GetData" call in a try/catch
block, and see what the exception is. If you can't connect via a debugger,
log the exception to disk, and then read the file.

--
Chris Mullins

"DEE" <tsdeepak@xxxxxx> wrote in message
news:c382ec01-454b-4def-be22-219b47c7d26c@xxxxxx
Quote:

> Hi There,
>
>
>
> The Service interface ,datacontracts ,configs are as below:
>
>
>
> [ServiceContract]
>
> public interface IService1
>
> {
>
> [OperationContract] CompositeType GetData(string name);
>
> [OperationContract] CompositeType
> GetDataUsingDataContract(CompositeType composite);
>
> }
>
> [DataContract]
>
> public class CompositeType
>
> {
>
> [DataMember]public string name;
>
> [DataMember]public IEnumerable<Property> properties;
>
> }
>
> [DataContract]
>
> public class Property
>
> {
>
> [DataMember] public string Name;
>
> [DataMember] public object Value;
>
> }
>
>
>
> Service implemention is as below :
>
>
>
> public class Service1 : IService1
>
> {
>
> public CompositeType GetData(string name)
>
> {
>
> List<Property> lstProperty = new List<Property>();
>
> lstProperty.Add(new Property { Name = "name", Value = "name1" });
>
> lstProperty.Add(new Property { Name = "description", Value =
> "description" });
>
> lstProperty.Add(new Property { Name = "createddate", Value =
> "createddate" });
>
> lstProperty.Add(new Property { Name = "modifieddate", Value =
> "modifieddate;" });
>
> return new CompositeType { name = "comp1", properties =
> lstProperty.ToArray() };
>
> }
>
>
>
>
>
> public CompositeType GetDataUsingDataContract(CompositeType composite)
>
> {
>
> throw new NotImplementedException();
>
> }
>
> }
>
>
>
> Server Config:
>
>
>
> <system.serviceModel>
>
> <services>
>
> <service behaviorConfiguration="WCFService1.Service1Behavior"
>
> name="WCFService1.Service1">
>
> <endpoint address="" binding="wsHttpBinding" bindingConfiguration=""
>
> contract="WCFService1.IService1" />
>
> <endpoint address="mex" binding="mexHttpBinding"
> contract="IMetadataExchange" />
>
> </service>
>
> </services>
>
> <behaviors>
>
> <serviceBehaviors>
>
> <behavior name="WCFService1.Service1Behavior">
>
> <!-- To avoid disclosing metadata information, set the value below to
> false and remove the metadata endpoint above before deployment -->
>
> <serviceMetadata httpGetEnabled="true"/>
>
> <!-- To receive exception details in faults for debugging purposes,
> set the value below to true. Set to false before deployment to avoid
> disclosing exception information -->
>
> <serviceDebug includeExceptionDetailInFaults="false"/>
>
> </behavior>
>
> </serviceBehaviors>
>
> </behaviors>
>
> </system.serviceModel>
>
>
>
>
>
> my client config looks like this:
>
>
>
> <system.serviceModel>
>
> <bindings>
>
> <wsHttpBinding>
>
> <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
>
> openTimeout="00:01:00" receiveTimeout="00:10:00"
> sendTimeout="00:01:00"
>
> bypassProxyOnLocal="false" transactionFlow="false"
> hostNameComparisonMode="StrongWildcard"
>
> maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
>
> messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
>
> allowCookies="false">
>
> <readerQuotas maxDepth="32" maxStringContentLength="8192"
> maxArrayLength="16384"
>
> maxBytesPerRead="4096" maxNameTableCharCount="16384" />
>
> <reliableSession ordered="true" inactivityTimeout="00:10:00"
>
> enabled="false" />
>
> <security mode="Message">
>
> <transport clientCredentialType="Windows" proxyCredentialType="None"
>
> realm="" />
>
> <message clientCredentialType="Windows"
> negotiateServiceCredential="true"
>
> algorithmSuite="Default" establishSecurityContext="true" />
>
> </security>
>
> </binding>
>
> </wsHttpBinding>
>
> </bindings>
>
> <client>
>
> <endpoint address="http://localhost:3841/Service1.svc"
> binding="wsHttpBinding"
>
> bindingConfiguration="WSHttpBinding_IService1"
> contract="ServiceReference.IService1"
>
> name="WSHttpBinding_IService1">
>
> <identity>
>
> <userPrincipalName value="shivakd@xxxxxx" />
>
> </identity>
>
> </endpoint>
>
> </client>
>
> </system.serviceModel>
>
>
>
>
>
> my Client Code:
>
>
>
> Service1Client client = new Service1Client();
>
> CompositeType comp = client.GetData("name");
>
> Console.WriteLine("comp.name");
>
> Console.ReadKey();
>
>
>
> The Problem:
>
>
>
> The composite type contains IEnumarable<Property> ,now if we call
> GetData on the client proxy ,which is suppose to return
> CompositeType , the Service will just exits ,without sending the
> response message.
>
>
>
> could any one throw some light on this.
>
>
>
> Thanks and Regards
>
> Dee

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Solved 'The User Profile Service service failed the logon' and forgotten password????? General Discussion
Is Windows Mail supporting Hotmail as a free service or is it a paid service Vista mail
Windows Service is crashing .NET General
The system event notification service service failed logon ... token does not exist General Discussion
How to install service to bypass Vista Interactive Services Detection Service Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46