Enabling WCF


To enable WCF as a replacement for .Net remoting in your solution, you need to update web.config of your site and include Appframe.WCFService as http module to be loaded.

  • Update Appframe to the latest version
  • Add <system.serviceModel> configuration to web.config if it does not exist
  •     
    <system.serviceModel> 
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> 
    </system.serviceModel> 
        
  • IMPORTANT Remove remoting section (<system.runtime.remoting>)
  • Choose one of the alternative ways of adding WCFService HttpModule reference. If the refence is added to web.config, it will only affect that website. If HttpModule reference is added to the database table, it will affect all websites connecting to that database.
    • Add web.config reference
      • R4
      •     
                                
        <system.webServer> 
            <modules> 
                <add name="Appframe.WCFService" type="Appframe.WCFService.HttpModule, Appframe.WCFService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1e44a67206b7f752" /> 
            </modules> 
        </system.webServer>
                                 
                            
      • Pims365
      •     
                                
        <system.webServer> 
            <modules> 
                <add name="Appframe365.WCFService" type="Appframe365.WCFService.HttpModule, Appframe365.WCFService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8d7cc5145eb52748" /> 
            </modules> 
        </system.webServer>
                                 
                            
    • Alternatively, insert reference into HttpModules table
      • R4
      •                         
        insert into dbo.stbl_WebSiteCMS_HttpModules (AssemblyName, TypeName)
        select 'Appframe.WCFService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1e44a67206b7f752', 'Appframe.WCFService.HttpModule'; 
                                
                            
      • Pims365
      •                         
        insert into dbo.stbl_WebSiteCMS_HttpModules (AssemblyName, TypeName)
        select 'Appframe365.WCFService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8d7cc5145eb52748', 'Appframe365.WCFService.HttpModule'; 
                                
                            
  • Test WCFService configuration
    • Try accessing /AfSQLWCF.svc endpoint. An error message will be returned if the endpoint is not functional.
    • Try accessing /AfFilestoreWCF.svc endpoint. An error message will be returned if the endpoint is not functional.
  • Test .Net remoting configuration
    • IMPORTANT Ensure .Net remoting is disabled by accessing /afremotingloader.rem?wsdl endpoint. An error message System.Runtime.Remoting.RemotingException: Requested Service not found will be displayed if .Net remoting service is disabled. Any other message indicates incomplete configuration.

Existing & new applications

When enabling WCF you should revise your application for database insert/update operations and procedure parameters. WCF is allowing only some certain/predefined types.

Standard types and Appframe ones:

  •     [ServiceKnownType(typeof(afParameter))]
  •     [ServiceKnownType(typeof(afParameterCollection))]
  •     [ServiceKnownType(typeof(afSelectColumn))]
  •     [ServiceKnownType(typeof(afGroupByColumn))]
  •     [ServiceKnownType(typeof(afOrderByColumn))]
  •     [ServiceKnownType(typeof(afReportRecordSourceLinkField))]
  •     [ServiceKnownType(typeof(afReportRecordSource))]
  •     [ServiceKnownType(typeof(DBNullSurrogated))]
  •     [ServiceKnownType(typeof(DataTableSurrogated))]
  •     [ServiceKnownType(typeof(afSelectColumnCollectionSurrogated))]
  •     [ServiceKnownType(typeof(afReportRecordSourceSurrogated))]

Known Issues

RequireSsl must be set for all cookies. If requireSsl is set to false and the site is accessed with HTTPS, WCF Remoting service will not work (endpoints errors).

Quotas may need to be increased to support large responses. The default message size value is 200000000. Configure following Appframe Access Layer settings in web.config:

        
<appSettings> 
    <add key="WCF_MaxReceivedMessageSize" value="200000000" /> 
</appSettings> 
        
    

Related articles

Placeholder "LocalizeWeb2016" failed