Thursday, 27 June 2019

Access WCF webservice using POSTMAN


Step 1: Create one WCF Service Application and add the below line for OperationContract

 [WebInvoke(Method = "POST",BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]



Step 2: Add the below script in web.config file.

<system.serviceModel>
    <services>
      <service behaviorConfiguration="Default" name="WcfService1.Service1">
        <endpoint address="web" behaviorConfiguration="webBehavior" binding="webHttpBinding" contract="WcfService1.IService1" />
        <endpoint address="ws" binding="wsHttpBinding" bindingConfiguration="wsBehavior" contract="WcfService1.IService1" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="webBehavior">
          <webHttp />
          <!--<enableWebScript/>-->
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="Default">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="wsBehavior">
          <security mode="None" >
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>




Step 3: Run the web service(in visual studio) and Copy the Service URL



Step 4: Add the parameters(ref the below screenshot) in Postman and send the request and you will get the successful response



Cheers, 😃 and enjoy your life.



Tuesday, 25 June 2019

SQL database shrink query

use db
go
sp_helpfile
ALTER DATABASE db SET RECOVERY SIMPLE WITH NO_WAIT
dbcc shrinkfile (db_log, 5)
--dbcc shrinkfile (db_log2, 5)
ALTER DATABASE db SET RECOVERY FULL WITH NO_WAIT