Darshan Kshirasagar

Darshan Kshirasagar

  • NA
  • 317
  • 69.2k

Wcf Service not running

Apr 26 2017 3:14 AM


using System;
using System.Xml.Linq;

namespace ZSL.IBanking
{
public class IBankingMWService : IIBankingMWService
{
//This method is exposed to the client based on request data it will give result
public string ExecuteProcessRequest(string reqData)
{
try
{
return CreateReturnResult(1, "Success");
}
catch (Exception ex)
{
return CreateReturnResult(1, ex.Message);
}
}

//Create result as XML format
private string CreateReturnResult(int errorNo, string errorMsg)
{
return (new XElement("Result",
new XElement("ErrorNo", errorNo.ToString()),
new XElement("Message", errorMsg))).ToString();
}
}
}




using System.ServiceModel;
using System.ServiceModel.Web;

namespace ZSL.IBanking
{
[ServiceContract(Namespace = "")]
public interface IIBankingMWService
{
[OperationContract]
[XmlSerializerFormat]
[WebInvoke(Method = "POST", UriTemplate = "/Execute/XML", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
string ExecuteProcessRequest(string xml);
}
}



<?xml version="1.0"?>
<configuration>

<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="ZSL.IBanking.IBankingMWServiceBehavior" name="ZSL.IBanking.IBankingMWService">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" contract="ZSL.IBanking.IIBankingMWService" behaviorConfiguration="web">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<webHttpBinding>
<binding transferMode="Streamed" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" openTimeout="00:25:00" closeTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00" name="webBinding">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ZSL.IBanking.IBankingMWServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>

</configuration>
 
 
 Output :
 
 
 
 

Answers (1)