Click here to Skip to main content
15,885,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have created an object dynamically using Reflection. I am calling a service to get the data from this object.

It is throwing error like.

The underlying connection was closed: The connection was closed unexpectedly.

C#
public Object ProjectProperties
       {
           get;
           set;
       }

C#
var myType = CompileResultType();
           var myObject = Activator.CreateInstance(myType);


I want to return myObject to the service in this format {sucess:true,Propjectproperties:{p1:v1,p2:v2}}
where Propjectproperties is dynamic type.

How can i return the object service which is created dynamically.?

Thanks in Advance for your responses and suggestions.. :)
Posted
Comments
Ganesh KP 24-Mar-15 6:43am    
I guess the error nothing do with your logic. Make sure that you have a valid connection string and place the statements in try... catch and find the exception.
[no name] 24-Mar-15 6:49am    
i am able to call other services from the same client.it works fine
[no name] 24-Mar-15 6:52am    
I dont find any issue with client
Sinisa Hajnal 24-Mar-15 7:28am    
What type is returned from Activator.CreateInstance? If it is an object, it would create problems with methods from the service. Other then that, ensure that your connection is opened and add try...catch blocks to see what happens when you try to connect (stack trace).
[no name] 24-Mar-15 7:50am    
its dynamic object.I have problem with returning dynamic object to the service.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900