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


When I am calling wcf rest service from wpf and call service from c# .Here i am get some error

Plz find the solution


ERROR IS I AM GETING

The remote server returned an error: (500) Internal Server Error.


WCF ENDPOINT IS
<system.serviceModel>
   <behaviors>
     <serviceBehaviors>
       <behavior name="RestBehavior">
         <serviceMetadata httpGetEnabled="true"/>
         <serviceDebug includeExceptionDetailInFaults="true"/>
         <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
       </behavior>
     </serviceBehaviors>
   </behaviors>

   <services>
     <service name="WcfService1.Service1" behaviorConfiguration="RestBehavior">
       <endpoint address=""
                 binding="webHttpBinding"
                 contract="WcfService1.IService1"></endpoint>

       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
     </service>
   </services>
     <protocolMapping>
       <add binding="webHttpBinding" scheme="https" />
   </protocolMapping>
   <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
 </system.serviceModel>



FROM WPF C# CODE CALL THE WCF SERVICE LIKE THIS HERE

//USed to make request to URI
           WebRequest myRequest = WebRequest.Create("http://localhost:50715/Service1.svc/GetAllEmployee");
           //Provides response from a URI.
           WebResponse myResponse = myRequest.GetResponse();
           //USed to Serialize and Deserialize instance of a type into an XML stream
           DataContractSerializer RecData = new DataContractSerializer(typeof(List<clsDataContracts.clsEmployee>));
           var CollectionEmployees = RecData.ReadObject(myResponse.GetResponseStream());
           this.lstEmpData.DataContext = CollectionEmployees;




THANK YOU
Posted
Comments
Bernhard Hiller 15-Jul-13 2:37am    
Learn some basics, e.g. reading error messages: "The remote server returned an error" - Where did the error happen? And did you show us a piece of relevant code?
vakativamsi 15-Jul-13 7:20am    
In WPF calling
Bernhard Hiller 15-Jul-13 8:22am    
Still wrong. The error happens on the SERVER in GetAllEmployee.

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