{"id":30583287,"url":"https://github.com/synergex/synnetwcf","last_synced_at":"2026-02-11T13:32:39.752Z","repository":{"id":149574599,"uuid":"436781813","full_name":"Synergex/SynNetWcf","owner":"Synergex","description":"An example of how to implement WCF services using Synergy .NET while providing the required AppDomain isolation and multi-threading protection needed for Synergy .NET code. This example implements the WCF service directly in code, not via a Synergy.NET Interop project.","archived":false,"fork":false,"pushed_at":"2022-07-26T13:27:55.000Z","size":428,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-29T10:49:52.955Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Smarty","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Synergex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-12-09T22:40:16.000Z","updated_at":"2022-08-04T17:01:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"427106df-d41e-4304-910a-bdf3f7ec522c","html_url":"https://github.com/Synergex/SynNetWcf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Synergex/SynNetWcf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSynNetWcf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSynNetWcf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSynNetWcf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSynNetWcf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Synergex","download_url":"https://codeload.github.com/Synergex/SynNetWcf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSynNetWcf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29333516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T12:42:24.625Z","status":"ssl_error","status_checked_at":"2026-02-11T12:41:23.344Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-29T08:33:32.060Z","updated_at":"2026-02-11T13:32:39.746Z","avatar_url":"https://github.com/Synergex.png","language":"Smarty","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SynNetWcf\u003cbr /\u003e\n**Created Date:** 5/22/2014\u003cbr /\u003e\n**Last Updated:** 6/19/2015\u003cbr /\u003e\n**Description:** An example of how to implement WCF services using Synergy .NET while providing the required AppDomain isolation and multi-threading protection needed for Synergy .NET code. This example implements the WCF service directly in code, not via a Synergy.NET Interop project. A different solution would be required in that case.\u003cbr /\u003e\n**Platforms:** Windows\u003cbr /\u003e\n**Products:** Synergy .NET\u003cbr /\u003e\n**Minimum Version:** 10.3.1\u003cbr /\u003e\n**Author:** Steve Ives, Jeff Greene\n\u003chr\u003e\n\n**Additional Information:** There are some special considerations that must be taken into account when\nexecuting Synergy .NET code in any multi-threaded environment. Specifically a\ndeveloper must give special consideration to how the following entities are\nused within the code, all of which exist at the process level:\n\n* Channels\n* COMMON data\n* GLOBAL data\n* STATIC data or other entities\n* Environment variables\n\nIn traditional Synergy environments (when compiling with dbl.exe and executing\nyour code with dbr.exe) your code executes in a process that is dedicated to\nrunning your program. If other users are running the same code then they are\nrunning it in the context of a totally seperate process. This means that each\ninstance of the code has private channels and common data, etc.\n\nHowever, in Synergy .NET it is possible to execute code in environments where\nmulti-threading (running several \"threads\" of code all within a single process)\nis supported. Examples of multi-threaded environments include:\n\n* Code that you write to execute code in multiple threads\n* ASP.NET Web applications\n* Windows Communication Foundation (WCF) services\n\nThere are two main things that must be considered when running code in any\nmulti-threaded environment:\n\n1. By default code running in all threads share the same Channels, COMMON\ndata, GLOBAL data and STATICs.\n\n2. If the code uses xfServer then it is critical that any given entity of\ncode always executes on the same thread, and the code must execute\nxcall s_server_thread_init before accessing xfServer.\n\nIf you want each instance of code to be isolated from all other instances, so\nthat channels, COMMONs, GLOBALs, etc. are unique to that thread, then the way\nto achieve that is to load each instance of the code into a seperate \"AppDomain\",\nand if xfServer is being used then it must also be ensured that each instance\nof the code always executes on the same thread. The sample code included with\nthis example demonstrates how to do that when implementing a WCF service.\n\nIMPORTANT: This example code does not address the issue of environment variables.\nIf your application uses XCALL SETLOG to set environment variables at runtime,\nand if the values of those environment variables vary (based on user, or some\nother criteria) then you must implement that functionality in some other way.\nIn Synergy (including Syenrgy .NET) environment variables are always set at the\nprocess level, and AppDomain protection DOES NOT CHANGE THAT!\n\nIMPORTANT: The instance of Visual Studio that is used to open and run this\ndemo code MUST be \"Run as Administrator\". If you don't do this then the server\napplication will fail to start because it won't have permissions to bind to\nyour network adapter, and the WebHost project may also fail to load.\n\nThe solution has been configured so that when you run the application BOTH\nthe ServiceHost and TestClient applications will be launched. You will see\nthe server applications console window appear almost immediately, but it is\nnormal for the TestClient application to take a few seconds to appear. This\nis because we're simultaneously launching two applications from one solution,\nand also because there is generally a brief delay in response from a WCF\nservice the first time a client connects after the service starts.\n\n================================================================================\nAppDomainProtection and AppDomainProtectionCore Projects\n\nThese two projects contain standard utility code that we have developed that is\nresponsible for implementing the AppDomain and thread locking protections that\nSynergy .NET code can require. You should be able to simply add copies of these\nprojects to your development solutions.\n\n================================================================================\nPartsSystem Project\n\nThis project is a Synergy .NET Class Library that essentially contains Synergy\nbusiness logic and database access code. The code in this class library is called\nby the code in the WCF service.\n\nMost of the code in this project was code generated using CodeGen. The CodeGen\ntemplates that were used can be found in the \"Templates\" solution folder, and\nthe CodeGen commands that were used can be found in the regen.bat batch file\nin the \"Solution Items\" solution folder.\n\n================================================================================\nWcfServiceLibrary Project\n\nThis project is a Synergy .NET WCF Service Library. It contains classes that\n\"wrap\" the business logic in the previous project in a WCF service.\n\nThe source files that begin with an I are used to define an \"Interface\" that\ndefines the \"contract\" exposed by the WCF Service. The other source files\ndefine a class that implements the contract interface.\n\nThe external interface of the sample WCF service uses an asychronous pattern in\nwhich each of the service operations (methods) returns a Task containing a\nresponse object. The response object in turn contains any and all data returned\nby the operation. All operations return at least two pieces of data:\n\n1. A return status defined by the ENUM MethodStatus.\n2. An error message, which is populated whenever the return status is anything\nother than success.\n\nA base response class named PartsServiceResponse is defined and conains properties\nfor these two \"standard\" return values. This class can be used for any methods\nthat only return status and error message, and can be extended by other return\ntype classes that need to contain additional data. You will see examples of this\nin various response classes defined in files such as IPartsService_Part.dbl.\n\nAgain, most of the code in this project was code generated using CodeGen. Some\nof the code is \"hand crafted\", you can find this code in the source files\nIPartsService_Custom.dbl and PartsService_Custom.dbl\n\n================================================================================\nServiceHost Project\n\nThis project is a Synergy .NET console application that is used to host the\nWCF service. When using this self-hosting project to host the service you will\nsee a console window apper containing this text:\n\nThe service is ready at http://localhost:50074\n\nPress a key to terminate the service\n\n================================================================================\nTestClient Project\n\nThis project is a very simple Synergy .NET WPF application. It has a service\nreference to the WCF service exposed by the WcfServiceLibrary, and uses some of\nthe WCF services methods.\n\n================================================================================\nWebHost Project\n\nThis project is a very simple Synergy ASP.NET Web application that can be used\nto host the WCF services using IIS Express or IIS.\n\n================================================================================\nStrong Name Signing\n\nIf you intend to host your Synergy .NET WCF services in Internet Information\nServer (IIS) then all assemblies that will be loaded in IIS (in the case of\nthis example that would be AppDomainProtection.dll, PartsSystem.dll and\nWcfServiceLibrary.dll) must be strong name signed.\n\n================================================================================\nTesting the environment\n\nYou can test the environment in one of three ways:\n\n1. SelfhHosting the WCF service\n----------------------------\n\nConfigure the solution to start BOTH the ServiceHost and TestClient projects,\nthis is done by right-clicking the SynNetWcf solution, selecting \"Set Startup\nProjects\", selecting \"Multiple Startup Projects\" and setting both of the\nrequired projects to an Action of Start.\n\nNear the top of TestClient\\ViewModel.dbl make sure that\nendPointName = \"SELF_HOSTED\" is enabled.\n\nSelect Debug \u003e Start Debugging\n\n2. Hosting the WCF service in the WebHost web application using IIS Express\n------------------------------------------------------------------------\n\nConfigure the Web projects properties to use \"IIS Express\" with the URL\nhttp://localhost:50075/\n\nConfigure the solution to start onlt the TestClient project, right-click on\nthe project and select Set as Startup Project.\n\nNear the top of TestClient\\ViewModel.dbl make sure that\nendPointName = \"IIS_EXPRESS\" is enabled.\n\nSelect Debug \u003e Start Debugging\n\n3. Hosting the WCF service in the WebHost web application using IIS\n----------------------------------------------------------------\n\nConfigure the Web projects properties to use \"Local IIS\" with the URL\nhttp://localhost/WebHost\n\nIf it is the first time you have done this, click the \"Create Virtual Directory\"\nbutton to configure the application in your local IIS server.\n\nConfigure the solution to start onlt the TestClient project, right-click on\nthe project and select Set as Startup Project.\n\nNear the top of TestClient\\ViewModel.dbl make sure that\nendPointName = \"IIS\" is enabled.\n\nSelect Debug \u003e Start Debugging\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynergex%2Fsynnetwcf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynergex%2Fsynnetwcf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynergex%2Fsynnetwcf/lists"}