programming4us
programming4us
WEBSITE

Sharepoint 2010 : Creating a Pluggable Workflow Service (part 3) - Hosting an .svc File in SharePoint, Token Replacement in Visual Studio , Adding WCF Service Configuration to SharePoint

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
Hosting an .svc File in SharePoint

To make our service available for our client application, we need to host it somewhere. Since SharePoint runs on Internet Information Server (IIS), we need to create a .svc file with details of our service implementation. Of course, before we create the file, we need somewhere to put it; for the purposes of this demonstration, we’ll use a custom subfolder within the %SPROOT%\TEMPLATE\Layouts folder. We can set up this folder automatically using our Visual Studio project.

  1. Choose Project | Add SharePoint “Layouts” Mapped Folder. You’ll notice that a new Layouts folder is added to the solution:

  2. We can now go ahead and add our CalculationResultService.svc file. In the Layouts\WorkflowDemonstration folder, add a new XML file named CalculationResultService.svc. Replace the contents of the file with the following:

    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$"%>
    <% @ServiceHost Service="WorkflowDemonstration.CalculationResultService" %>
Token Replacement in Visual Studio

Visual Studio 2010 allows the use of replaceable tokens when creating SharePoint solution packages. Our code sample makes use of the token $SharePoint.Project.AssemblyFullName$ that will be replaced when the package is built, by the four-part assembly name for the associated assembly. However, at the time of writing, no WCF template is available for SharePoint. Therefore, tokens are not automatically replaced in files with an .svc extension.

Thankfully, this is a simple problem to resolve. Navigate to C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools and then open the Microsoft.VisualStudio.SharePoint.targets file. This is an XML format file that defines various configuration settings for building SharePoint projects. Find the TokenReplacementFileExtensions element and append svc to the list of file extensions as shown:

<TokenReplacementFileExtensions>$(TokenReplacementFileExtensions);xml;aspx;ascx;
webpart;dwp;svc </TokenReplacementFileExtensions>



Adding WCF Service Configuration to SharePoint

As well as an .svc file, IIS also needs to read the configuration of the WCF service from the web.config file. For the purposes of our demonstration, we’ll make the necessary changes manually.

  1. Open the web.config file for our application (at C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config if the application is the first application running on port 80). In the system.serviceModel element, add the following configuration details:

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <bindings>
    <basicHttpBinding>
    <binding name="WfDemoBinding">
    <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm" />
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>
    <behaviors>
    <serviceBehaviors>
    <behavior name="WfDemoBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <services>
    <service behaviorConfiguration="WfDemoBehavior"
    name="WorkflowDemonstration.CalculationResultService">
    <endpoint address="" binding="basicHttpBinding"
    bindingConfiguration="WfDemoBinding"
    contract="WorkflowDemonstration.ICalculationResultService">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <host>
    <baseAddresses>
    <add baseAddress="http://localhost/_layouts/WorkflowDemonstration" />
    </baseAddresses>
    </host>
    </service>
    </services>


We’re now ready to deploy the service to SharePoint. From the Build menu select Deploy WorkflowDemonstration. Visual Studio will now build the solution, create a WSP package, and then deploy the package to our SharePoint server.

As we did for our client application, we can now make use of WCFTestClient to send a test call to our WCF service. This time the endpoint address will be http://localhost/_layouts/WorkflowDemonstration/CalculationResultService.svc. If all is well, our service will return True when invoked as per our stub implementation.

Other  
  •  PowerShell for SharePoint 2013 : Word Automation Services - Disable Word 97–2003 Document Scanning , Disable Embedded Fonts in Conversions
  •  PowerShell for SharePoint 2013 : Word Automation Services - Modify Job Monitoring, Modify Conversion Timeouts
  •  PowerShell for SharePoint 2013 : Word Automation Services - Configure Supported Document Formats for Conversion, Modify Database Information
  •  PowerShell for SharePoint 2013 : Word Automation Services - Configure the Conversion Processes, Configure Conversion Throughput
  •  ASP.NET 4 : Error Handling, Logging, and Tracing - Throwing Your Own Exceptions
  •  ASP.NET 4 : Error Handling, Logging, and Tracing - Handling Exceptions
  •  ASP.NET 4 : Error Handling, Logging, and Tracing - Exception Handling
  •  ASP.NET 4 : Error Handling, Logging, and Tracing - Common Errors
  •  Sharepoint 2010 : Designing a Workflow Using Visio 2010 (part 3) - Using Visio Services to Visualize Workflow State
  •  Sharepoint 2010 : Designing a Workflow Using Visio 2010 (part 2) - Implementing a Visio Workflow Using SharePoint Designer
  •  
    Top 10
    Free Mobile And Desktop Apps For Accessing Restricted Websites
    MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
    TOYOTA CAMRY 2; 2.5 : Camry now more comely
    KIA SORENTO 2.2CRDi : Fuel-sipping slugger
    How To Setup, Password Protect & Encrypt Wireless Internet Connection
    Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
    Backup & Restore Game Progress From Any Game With SaveGameProgress
    Generate A Facebook Timeline Cover Using A Free App
    New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
    SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
    - Messages forwarded by Outlook rule go nowhere
    - Create and Deploy Windows 7 Image
    - How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
    - Creating and using an unencrypted cookie in ASP.NET
    - Directories
    - Poor Performance on Sharepoint 2010 Server
    - SBS 2008 ~ The e-mail alias already exists...
    - Public to Private IP - DNS Changes
    - Send Email from Winform application
    - How to create a .mdb file from ms sql server database.......
    programming4us programming4us
    programming4us
     
     
    programming4us