3
Answers

WCF service issue

Photo of Vamsi k

Vamsi k

5y
654
1
Hi Everyone,
 
We have created a WCF service . We are able to access that service locally. But when we deployed that service in Test server we are not able to access that service, Can you pls suggest how to publish the wcf code and how to deploy in the server. what changes we need to do before deploying into Test server? Below are confg files information.
 
Example
 
Service web.test1.config:
 
<services>
<service name="ABC_WcfService.ABCService" behaviorConfiguration="ABCBehaviorName">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="ABCBindName" contract="ABC_WcfService.IABCService"></endpoint>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="ABCBindName" maxReceivedMessageSize="10485760" maxBufferSize="10485760" >
</binding>
</basicHttpBinding>
</bindings>
Client web.test.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<!--<binding name="BasicHttpBinding_IABCService" maxReceivedMessageSize="100485760"/>-->
<binding name="BasicHttpBinding_IABCService" closeTimeout="00:50:00" openTimeout="00:50:00"
receiveTimeout="00:50:00" sendTimeout="00:50:00" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="5242880"
maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://abc_wcfservicetest1.test.intranet/ABCService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IABCService" contract="ServiceReference1.IABCService" name="BasicHttpBinding_IABCService"/>
</client>
</system.serviceModel>
 
Please give response ASAP.
Thanks,
Vamsi.

Answers (3)

0
Photo of Mageshwaran R
NA 10.8k 1.1m 5y
Hi,
try this code:
  1. <?xml version="1.0"?>  
  2. <configuration>  
  3. <connectionStrings>  
  4.   <add name="Json_ConnectionString" connectionString="Data Source="ConnectionString"/>  
  5. </connectionStrings>  
  6.   <appSettings>  
  7.     <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />  
  8.   </appSettings>  
  9.   <system.web>  
  10.     <compilation debug="true" targetFramework="4.6.1" />  
  11.     <httpRuntime targetFramework="4.6.1"/>  
  12.   </system.web>  
  13.   <system.serviceModel>  
  14.     <behaviors>  
  15.       <serviceBehaviors>  
  16.         <behavior name="BehaviourName">  
  17.           <!-- To avoid disclosing metadata information, set the values below to false before deployment -->  
  18.           <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>  
  19.           <!-- 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 -->  
  20.           <serviceDebug includeExceptionDetailInFaults="false"/>  
  21.         </behavior>  
  22.       </serviceBehaviors>  
  23.       <endpointBehaviors>  
  24.         <behavior name="Web">  
  25.           <webHttp/>  
  26.         </behavior>  
  27.       </endpointBehaviors>  
  28.     </behaviors>  
  29.     <services>  
  30.       <service behaviorConfiguration="BehaviourName" name="Service.Service">  
  31.         <endpoint   behaviorConfiguration="Web" binding="webHttpBinding"  
  32.           contract="Service.IService" />  
  33.       </service>  
  34.     </services>  
  35.     <protocolMapping>  
  36.         <add binding="basicHttpsBinding" scheme="https" />  
  37.     </protocolMapping>      
  38.     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />  
  39.   </system.serviceModel>  
  40.   <system.webServer>  
  41.     <modules runAllManagedModulesForAllRequests="true"/>  
  42.     <!--  
  43.         To browse web app root directory during debugging, set the value below to true.  
  44.         Set to false before deployment to avoid disclosing web app folder information.  
  45.       -->  
  46.     <directoryBrowse enabled="true"/>  
  47.   </system.webServer>  
  48.   
  49. </configuration>  
 
0
Photo of Sivakumar Koneti
585 1.9k 14.5k 5y
watch this video u can get clarity 
 
https://www.youtube.com/watch?v=PBAs3zw6rq0
0
Photo of Salman Beg
156 12.1k 624.1k 5y
Hey. You need to deploy the service in server then only it will work. For more you can follow up with this link, https://www.c-sharpcorner.com/article/hosting-wcf-service-on-iis/