Click here to Skip to main content
15,867,956 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i created a wcf web service. my service uses EF5 data acceess to fetch data.

i have only one function named GetAllAdminList() code: IAdminService.cs
C#
public interface IAdminService
   {
       [OperationContract]
       List<TblAdmin> GetAllAdminList();
   }


And AdminService.svc.cs
C#
public class AdminService : IAdminService
   {
       public List<TblAdmin> GetAllAdminList()
       {
           AdminJobBal adminBal = new AdminJobBal();
           return adminBal.GetAllAdminList();

       }

   }


Here the code part is returning the listofAdminUser from database.

Now When i am invoking the service on setting service as startup project and AdminService.svc.cs as startup page it throws me a error

An error occurred while receiving the HTTP response to "localhost:13001/AdminService/AdminService.svc" This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

i can assure u that my data access code works,bcoz i dubug that project and i saw that it return the List perfectly! the problem occures AFTER the return value of List

to check And also i have an another svc that
C#
public class Service1 : IService1
   {
      public string GetName(string Name)
       {
           return "hello" + Name;
       }

   }



when i make it startuppage it's invoking fine and returning the string.
Don't know what is the main problem,please help me to resolve it.

the web config file is
HTML
<configuration>
  <connectionStrings>
    <add name="ParasharPortalEntities" connectionString="metadata=res://*/CommonEntity.ParasharPortal.csdl|res://*/CommonEntity.ParasharPortal.ssdl|res://*/CommonEntity.ParasharPortal.msl;provider=System.Data.SqlClient;provider connection string="data source=AMIT-PC;initial catalog=ParasharPortal-1.0;user id=sa;password=samsung;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false 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="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>


and the TblAdmin Entities is like This
C#
public class TblAdmin
   {
       public TblAdmin();

       public int AdminId { get; set; }
       public string AdminName { get; set; }
       public string AdminPassword { get; set; }
       public string AdminUserName { get; set; }
       public string ContactNumber { get; set; }
       public DateTime CreatedOn { get; set; }
       public string Description { get; set; }
       public bool IsActive { get; set; }
       public bool IsDeleted { get; set; }
       public virtual ICollection<TblCity> TblCities { get; set; }
       public virtual ICollection<TblCompany> TblCompanies { get; set; }
       public virtual ICollection<TblCountry> TblCountries { get; set; }
       public virtual ICollection<TblJob> TblJobs { get; set; }
       public virtual ICollection<TblJobType> TblJobTypes { get; set; }
       public virtual ICollection<TblSkillGroup> TblSkillGroups { get; set; }
       public virtual ICollection<TblSkill> TblSkills { get; set; }
       public virtual ICollection<TblState> TblStates { get; set; }
   }
Posted
Updated 1-Dec-14 7:52am
v2
Comments
Er. Dinesh Sharma 1-Dec-14 3:24am    
Which binding you have used? and if possible send config file.
Amit Kumar143 1-Dec-14 13:56pm    
i think the problem is in using complex class.
because instead of returning List<TblAdmin> when i am returning a List<customeclass>
an binding in a query,it is working fine.
Do you Know How to resolve this problem,and any modification needed here to return List<TblAdmin>?
Kornfeld Eliyahu Peter 2-Dec-14 3:14am    
It seems your binding is HTTPS and not HTTP...
Senthoor Muthu 2-Dec-14 4:44am    
I Thing U'r Service is Temp stop.........
Subramanyam Shankar 7-Mar-15 1:27am    
You cannot return a list like that in WCF you need wrap your list of datacontracts in your message contracts and then send it. Hence it's failing.

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