I have created a rest wcf service that is hosted on IIS window server environment. When I try accessing the service(http://localhost:8081/Service1.svc/EmployeeDump) from IIS it returns blank xml response. It does not give any error, just a blank xml is returned. However, service wsdl(metadata) file is accessible from browser. The service works fine when I run it on Visual Studio and endpoint methods returns data response in xml. But when I host same service in IIS server, it returns blank response I don't know why.
I tried installing HTTP Activation feature from server manager and tried changing the web config parameters such as adding host option but still the same issue.
Below is my web config:
<?xml version="1.0"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="MyDB"connectionString="server=xyz\abc;database=testDB;Integrated Security = SSPI;"/>
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation targetFramework="4.6.1" debug="true"/>
<httpRuntime targetFramework="4.6.1"/>
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webHttpTransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="MasterDumpService.Service1" behaviorConfiguration="myServiceBehavior">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="webBehavior" contract="MasterDumpService.IService1"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MasterDumpService.ServiceAuthenticator, MasterDumpService"/>
</serviceCredentials>
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</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>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
</configuration>
Below is the blank xml response that I am getting from service hosted on IIS:
<?xml version="1.0"?>
<ArrayOfEmployeeDump xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MasterDumpService"/>
And below is the correct xml response(which the hosted service should actually return) when I run the service from visual studio on browser:
<?xml version="1.0"?>
-<ArrayOfEmployeeDump xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MasterDumpService">
-<EmployeeDump>
<BusinessUnit/>
<Department>E commerce</Department>
<DisplayName>Gayathri</DisplayName>
<Mail>[email protected]</Mail>
</EmployeeDump>
-<EmployeeDump>
<BusinessUnit/>
<Department/>
<DisplayName>kiran</DisplayName>
<Mail>[email protected]</Mail>
</EmployeeDump>
-<EmployeeDump>
<BusinessUnit/>
<Department/>
<DisplayName>xyz</DisplayName>
<Mail>[email protected]</Mail>
</EmployeeDump>
Any help will be greatly appreciated.

<endpoint address="/Service" binding="webHttpBinding" behaviorConfiguration="webBehavior" contract="MasterDumpService.IService1"/>- Try Adding address to endpoint tag in WCF Config - user2932057