Amit Kumar

Amit Kumar

  • 1.6k
  • 54
  • 26.7k

Failed to Invoke the WCF Service

Dec 1 2014 1:12 PM
Hello,
i created a wcf web service. my service uses EF5 data acceess to fetch data.

i have only one function named GetAllAdminList()

IAdminService.cs
 
 public interface IAdminService {
       [OperationContract] 
        List<TblAdmin> GetAllAdminList();
 }
And AdminService.svc.cs
 
 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

 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.

TblAdmin Entity is like this
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; }
}
 and my web config file is like this
 
<?xml version="1.0"?>
<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=&quot;data source=AMIT-PC;initial catalog=ParasharPortal-1.0;user id=sa;password=samsung;MultipleActiveResultSets=True;App=EntityFramework&quot;" 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>
 
 

Don't know what is the main problem,please help me to resolve it.


Answers (1)