diff --git a/WCFHost/App.config b/WCFHost/App.config new file mode 100644 index 0000000000000000000000000000000000000000..56efbc7b5f15b5166cc89dae0406895b57de0b67 --- /dev/null +++ b/WCFHost/App.config @@ -0,0 +1,6 @@ +п»ї<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> + </startup> +</configuration> \ No newline at end of file diff --git a/WCFHost/Program.cs b/WCFHost/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..abf51a40b8e7c94ab0469d7c8bd8a669cd67294d --- /dev/null +++ b/WCFHost/Program.cs @@ -0,0 +1,20 @@ +п»їusing System.ServiceProcess; + +namespace WCFHost +{ + static class Program + { + /// <summary> + /// Главная точка РІС…РѕРґР° для приложения. + /// </summary> + static void Main() + { + ServiceBase[] ServicesToRun; + ServicesToRun = new ServiceBase[] + { + new UTCTimeService() + }; + ServiceBase.Run(ServicesToRun); + } + } +} diff --git a/WCFHost/Properties/AssemblyInfo.cs b/WCFHost/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..04b1e5b5a1b94ccd3eecede51fae7665c3d1bd8e --- /dev/null +++ b/WCFHost/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +п»їusing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения РѕР± этой СЃР±РѕСЂРєРµ предоставляются следующим набором +// набора атрибутов. Рзмените значения этих атрибутов, чтобы изменить сведения, +// общие сведения РѕР± этой СЃР±РѕСЂРєРµ. +[assembly: AssemblyTitle("WCFHost")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WCFHost")] +[assembly: AssemblyCopyright("Copyright В© 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы РІ этой СЃР±РѕСЂРєРµ невидимыми +// для компонентов COM. Если необходимо обратиться Рє типу РІ этой СЃР±РѕСЂРєРµ через +// компонент COM, задайте для атрибута ComVisible этого типа значение TRUE. +[assembly: ComVisible(false)] + +// Указанный ниже идентификатор GUID предназначен для идентификации библиотеки типов, если этот проект будет видимым для COM-объектов +[assembly: Guid("da5b3eb1-6b0e-43a4-9392-2027c233feb9")] + +// Сведения Рѕ версии СЃР±РѕСЂРєРё состоят РёР· указанных ниже четырех значений: +// +// РћСЃРЅРѕРІРЅРѕР№ номер версии +// Дополнительный номер версии +// Номер СЃР±РѕСЂРєРё +// Номер редакции +// +// Можно задать РІСЃРµ значения или принять номера СЃР±РѕСЂРєРё Рё редакции РїРѕ умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WCFHost/UTCTimeServiceInstaller.Designer.cs b/WCFHost/UTCTimeServiceInstaller.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..7c82e900f4ca44c189efb6b078275f1b1fa84042 --- /dev/null +++ b/WCFHost/UTCTimeServiceInstaller.Designer.cs @@ -0,0 +1,56 @@ +п»їnamespace WCFHost +{ + partial class UTCTimeServiceInstaller + { + /// <summary> + /// Обязательная переменная конструктора. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Освободить РІСЃРµ используемые ресурсы. + /// </summary> + /// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region РљРѕРґ, автоматически созданный конструктором компонентов + + /// <summary> + /// Требуемый метод для поддержки конструктора — РЅРµ изменяйте + /// содержимое этого метода СЃ помощью редактора РєРѕРґР°. + /// </summary> + private void InitializeComponent() + { + this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); + this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); + // + // serviceProcessInstaller1 + // + this.serviceProcessInstaller1.Password = null; + this.serviceProcessInstaller1.Username = null; + // + // serviceInstaller1 + // + this.serviceInstaller1.ServiceName = "Service1"; + // + // ProjectInstaller + // + this.Installers.AddRange(new System.Configuration.Install.Installer[] { + this.serviceProcessInstaller1, + this.serviceInstaller1}); + + } + + #endregion + + private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; + private System.ServiceProcess.ServiceInstaller serviceInstaller1; + } +} \ No newline at end of file diff --git a/WCFHost/UTCTimeServiceInstaller.cs b/WCFHost/UTCTimeServiceInstaller.cs new file mode 100644 index 0000000000000000000000000000000000000000..b540fba492ef8a8118347d31ed4050653df25786 --- /dev/null +++ b/WCFHost/UTCTimeServiceInstaller.cs @@ -0,0 +1,29 @@ +п»їusing System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration.Install; +using System.Linq; +using System.Threading.Tasks; +using System.ServiceProcess; + +namespace WCFHost +{ + [RunInstaller(true)] + public partial class UTCTimeServiceInstaller : System.Configuration.Install.Installer + { + public UTCTimeServiceInstaller() + { + serviceProcessInstaller1 = new ServiceProcessInstaller(); + serviceProcessInstaller1.Account = ServiceAccount.LocalSystem; + serviceInstaller1 = new ServiceInstaller(); + serviceInstaller1.ServiceName = "UTCTimeNow"; + serviceInstaller1.DisplayName = "UTCTimeNow"; + serviceInstaller1.Description = "Service for getting UTCTime now by Gerasimov Aleksey"; + serviceInstaller1.StartType = ServiceStartMode.Automatic; + Installers.Add(serviceProcessInstaller1); + Installers.Add(serviceInstaller1); + // InitializeComponent(); + } + } +} diff --git a/WCFHost/UTCTimeServiceInstaller.resx b/WCFHost/UTCTimeServiceInstaller.resx new file mode 100644 index 0000000000000000000000000000000000000000..5c8b468120203283b1dc8c53d970eee18e6c3d80 --- /dev/null +++ b/WCFHost/UTCTimeServiceInstaller.resx @@ -0,0 +1,129 @@ +п»ї<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="serviceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="serviceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>196, 17</value> + </metadata> + <metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </metadata> +</root> \ No newline at end of file diff --git a/WCFHost/UtcTimeService.Designer.cs b/WCFHost/UtcTimeService.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..4583685226f7c3b934a22ff6131e88c26d14b8c8 --- /dev/null +++ b/WCFHost/UtcTimeService.Designer.cs @@ -0,0 +1,37 @@ +п»їnamespace WCFHost +{ + partial class UTCTimeService + { + /// <summary> + /// Обязательная переменная конструктора. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Освободить РІСЃРµ используемые ресурсы. + /// </summary> + /// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region РљРѕРґ, автоматически созданный конструктором компонентов + + /// <summary> + /// Требуемый метод для поддержки конструктора — РЅРµ изменяйте + /// содержимое этого метода СЃ помощью редактора РєРѕРґР°. + /// </summary> + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.ServiceName = "Service1"; + } + + #endregion + } +} diff --git a/WCFHost/UtcTimeService.cs b/WCFHost/UtcTimeService.cs new file mode 100644 index 0000000000000000000000000000000000000000..03e33e278aa9667968478e6477424e671c84a74f --- /dev/null +++ b/WCFHost/UtcTimeService.cs @@ -0,0 +1,53 @@ +п»їusing System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Linq; +using System.ServiceProcess; +using System.Text; +using System.Threading.Tasks; +using System.ServiceModel; +using System.ServiceModel.Description; + +namespace WCFHost +{ + public partial class UTCTimeService : ServiceBase + { + private ServiceHost service_host = null; + public UTCTimeService() + { + InitializeComponent(); + } + + protected override void OnStart(string[] args) + { + //конфигурация хоста + if (service_host != null) service_host.Close(); + + string address_HTTP = "http://localhost:9001/UTCTimeService"; + + + Uri[] address_base = { new Uri(address_HTTP) }; + service_host = new ServiceHost(typeof(WCFServiceLibrary.Service.UTCTimeService), address_base); + + ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); + service_host.Description.Behaviors.Add(behavior); + + BasicHttpBinding binding_http = new BasicHttpBinding(); + service_host.AddServiceEndpoint(typeof(WCFServiceLibrary.Contract.IUTCTimeService), binding_http, address_HTTP); + service_host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); + + service_host.Open(); + } + + protected override void OnStop() + { + if (service_host != null) + { + service_host.Close(); + service_host = null; + } + } + } +} diff --git a/WCFHost/WCFHost.csproj b/WCFHost/WCFHost.csproj new file mode 100644 index 0000000000000000000000000000000000000000..085147a08ef93427c919ed861dfb4f29f59d93bc --- /dev/null +++ b/WCFHost/WCFHost.csproj @@ -0,0 +1,80 @@ +п»ї<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{DA5B3EB1-6B0E-43A4-9392-2027C233FEB9}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>WCFHost</RootNamespace> + <AssemblyName>WCFHost</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</Deterministic> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Configuration.Install" /> + <Reference Include="System.Core" /> + <Reference Include="System.Management" /> + <Reference Include="System.ServiceModel" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.ServiceProcess" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="UTCTimeServiceInstaller.cs"> + <SubType>Component</SubType> + </Compile> + <Compile Include="UTCTimeServiceInstaller.Designer.cs"> + <DependentUpon>UTCTimeServiceInstaller.cs</DependentUpon> + </Compile> + <Compile Include="UTCTimeService.cs"> + <SubType>Component</SubType> + </Compile> + <Compile Include="UTCTimeService.Designer.cs"> + <DependentUpon>UTCTimeService.cs</DependentUpon> + </Compile> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\WCFServiceLibrary\WCFServiceLibrary.csproj"> + <Project>{288b8e71-2161-439e-96ee-2e088a2830a9}</Project> + <Name>WCFServiceLibrary</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="UTCTimeServiceInstaller.resx"> + <DependentUpon>UTCTimeServiceInstaller.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/WCFService.sln b/WCFService.sln new file mode 100644 index 0000000000000000000000000000000000000000..ddd3cf0f72cfa48b0c24d2329884b45f3b5590c0 --- /dev/null +++ b/WCFService.sln @@ -0,0 +1,37 @@ +п»ї +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29123.88 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WCFService", "WCFService\WCFService.csproj", "{B26758C2-29B2-4697-AD77-B50F8A8062D6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WCFHost", "WCFHost\WCFHost.csproj", "{DA5B3EB1-6B0E-43A4-9392-2027C233FEB9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WCFServiceLibrary", "WCFServiceLibrary\WCFServiceLibrary.csproj", "{288B8E71-2161-439E-96EE-2E088A2830A9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B26758C2-29B2-4697-AD77-B50F8A8062D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B26758C2-29B2-4697-AD77-B50F8A8062D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B26758C2-29B2-4697-AD77-B50F8A8062D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B26758C2-29B2-4697-AD77-B50F8A8062D6}.Release|Any CPU.Build.0 = Release|Any CPU + {DA5B3EB1-6B0E-43A4-9392-2027C233FEB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA5B3EB1-6B0E-43A4-9392-2027C233FEB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA5B3EB1-6B0E-43A4-9392-2027C233FEB9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA5B3EB1-6B0E-43A4-9392-2027C233FEB9}.Release|Any CPU.Build.0 = Release|Any CPU + {288B8E71-2161-439E-96EE-2E088A2830A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {288B8E71-2161-439E-96EE-2E088A2830A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {288B8E71-2161-439E-96EE-2E088A2830A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {288B8E71-2161-439E-96EE-2E088A2830A9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C9747986-6430-4184-AA81-45FD0573ACF5} + EndGlobalSection +EndGlobal diff --git a/WCFService/Controllers/UTCTimeController.cs b/WCFService/Controllers/UTCTimeController.cs new file mode 100644 index 0000000000000000000000000000000000000000..72436467959364e591d9e87adde86acf4be43523 --- /dev/null +++ b/WCFService/Controllers/UTCTimeController.cs @@ -0,0 +1,25 @@ +п»їusing System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using ServiceReference; + +namespace WCFService.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class UTCTimeController : ControllerBase + { + + [HttpGet] + public string GetTime() + { + UTCTimeServiceClient uTCTimeServiceClient = new UTCTimeServiceClient( UTCTimeServiceClient.EndpointConfiguration.BasicHttpBinding_IUTCTimeService); + var result = uTCTimeServiceClient.GetUTCTimeNowAsync(); + return result.Result; + } + + + } +} diff --git a/WCFService/Program.cs b/WCFService/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..0a603a3561bb5321b01f45cb3a7dc18e7bcb9129 --- /dev/null +++ b/WCFService/Program.cs @@ -0,0 +1,24 @@ +п»їusing System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace WCFService +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup<Startup>(); + } +} diff --git a/WCFService/Properties/launchSettings.json b/WCFService/Properties/launchSettings.json new file mode 100644 index 0000000000000000000000000000000000000000..d806d223d98630f7334f3df1e48c5b7538ce06eb --- /dev/null +++ b/WCFService/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:51331", + "sslPort": 44342 + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "api/UTCTime", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "WCFService": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + } + } +} \ No newline at end of file diff --git a/WCFService/ServiceReference/Reference.cs b/WCFService/ServiceReference/Reference.cs new file mode 100644 index 0000000000000000000000000000000000000000..ac4f2e1e841ef7ef4cb22a628b47c8538c70cf0e --- /dev/null +++ b/WCFService/ServiceReference/Reference.cs @@ -0,0 +1,127 @@ +п»ї//------------------------------------------------------------------------------ +// <auto-generated> +// Ртот РєРѕРґ создан программой. +// +// Рзменения РІ этом файле РјРѕРіСѓС‚ привести Рє неправильной работе Рё Р±СѓРґСѓС‚ потеряны РІ случае +// повторного создания РєРѕРґР°. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace ServiceReference +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="ServiceReference1.IUTCTimeService")] + public interface IUTCTimeService + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IUTCTimeService/GetUTCTimeNow", ReplyAction="http://tempuri.org/IUTCTimeService/GetUTCTimeNowResponse")] + System.Threading.Tasks.Task<string> GetUTCTimeNowAsync(); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.0")] + public interface IUTCTimeServiceChannel : ServiceReference.IUTCTimeService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.0")] + public partial class UTCTimeServiceClient : System.ServiceModel.ClientBase<ServiceReference.IUTCTimeService>, ServiceReference.IUTCTimeService + { + + /// <summary> + /// Реализуйте этот разделяемый метод для настройки конечной точки службы. + /// </summary> + /// <param name="serviceEndpoint">Настраиваемая конечная точка</param> + /// <param name="clientCredentials">Учетные данные клиента.</param> + static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials); + + public UTCTimeServiceClient() : + base(UTCTimeServiceClient.GetDefaultBinding(), UTCTimeServiceClient.GetDefaultEndpointAddress()) + { + this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IUTCTimeService.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public UTCTimeServiceClient(EndpointConfiguration endpointConfiguration) : + base(UTCTimeServiceClient.GetBindingForEndpoint(endpointConfiguration), UTCTimeServiceClient.GetEndpointAddress(endpointConfiguration)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public UTCTimeServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : + base(UTCTimeServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public UTCTimeServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : + base(UTCTimeServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public UTCTimeServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public System.Threading.Tasks.Task<string> GetUTCTimeNowAsync() + { + return base.Channel.GetUTCTimeNowAsync(); + } + + public virtual System.Threading.Tasks.Task OpenAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen)); + } + + public virtual System.Threading.Tasks.Task CloseAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose)); + } + + private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IUTCTimeService)) + { + System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(); + result.MaxBufferSize = int.MaxValue; + result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; + result.MaxReceivedMessageSize = int.MaxValue; + result.AllowCookies = true; + return result; + } + throw new System.InvalidOperationException(string.Format("РќРµ удалось найти конечную точку СЃ именем \"{0}\".", endpointConfiguration)); + } + + private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IUTCTimeService)) + { + return new System.ServiceModel.EndpointAddress("http://localhost:9001/UTCTimeService"); + } + throw new System.InvalidOperationException(string.Format("РќРµ удалось найти конечную точку СЃ именем \"{0}\".", endpointConfiguration)); + } + + private static System.ServiceModel.Channels.Binding GetDefaultBinding() + { + return UTCTimeServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IUTCTimeService); + } + + private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() + { + return UTCTimeServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IUTCTimeService); + } + + public enum EndpointConfiguration + { + + BasicHttpBinding_IUTCTimeService, + } + } +} diff --git a/WCFService/ServiceReference/dotnet-svcutil.params.json b/WCFService/ServiceReference/dotnet-svcutil.params.json new file mode 100644 index 0000000000000000000000000000000000000000..e9b717a87d9664ee07a016f50e4265df44cb2d15 --- /dev/null +++ b/WCFService/ServiceReference/dotnet-svcutil.params.json @@ -0,0 +1,184 @@ +{ + "providerId": "Microsoft.Tools.ServiceModel.Svcutil", + "version": "2.0.0", + "options": { + "inputs": [ + "http://localhost:9001/UTCTimeService" + ], + "namespaceMappings": [ + "*, ServiceReference1" + ], + "outputFile": "Reference.cs", + "references": [ + "Microsoft.AspNetCore, {Microsoft.AspNetCore, 2.1.1}", + "Microsoft.AspNetCore.Antiforgery, {Microsoft.AspNetCore.Antiforgery, 2.1.1}", + "Microsoft.AspNetCore.Authentication, {Microsoft.AspNetCore.Authentication, 2.1.1}", + "Microsoft.AspNetCore.Authentication.Abstractions, {Microsoft.AspNetCore.Authentication.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Authentication.Cookies, {Microsoft.AspNetCore.Authentication.Cookies, 2.1.1}", + "Microsoft.AspNetCore.Authentication.Core, {Microsoft.AspNetCore.Authentication.Core, 2.1.1}", + "Microsoft.AspNetCore.Authentication.Facebook, {Microsoft.AspNetCore.Authentication.Facebook, 2.1.1}", + "Microsoft.AspNetCore.Authentication.Google, {Microsoft.AspNetCore.Authentication.Google, 2.1.1}", + "Microsoft.AspNetCore.Authentication.JwtBearer, {Microsoft.AspNetCore.Authentication.JwtBearer, 2.1.1}", + "Microsoft.AspNetCore.Authentication.MicrosoftAccount, {Microsoft.AspNetCore.Authentication.MicrosoftAccount, 2.1.1}", + "Microsoft.AspNetCore.Authentication.OAuth, {Microsoft.AspNetCore.Authentication.OAuth, 2.1.1}", + "Microsoft.AspNetCore.Authentication.OpenIdConnect, {Microsoft.AspNetCore.Authentication.OpenIdConnect, 2.1.1}", + "Microsoft.AspNetCore.Authentication.Twitter, {Microsoft.AspNetCore.Authentication.Twitter, 2.1.1}", + "Microsoft.AspNetCore.Authentication.WsFederation, {Microsoft.AspNetCore.Authentication.WsFederation, 2.1.1}", + "Microsoft.AspNetCore.Authorization, {Microsoft.AspNetCore.Authorization, 2.1.1}", + "Microsoft.AspNetCore.Authorization.Policy, {Microsoft.AspNetCore.Authorization.Policy, 2.1.1}", + "Microsoft.AspNetCore.Connections.Abstractions, {Microsoft.AspNetCore.Connections.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.CookiePolicy, {Microsoft.AspNetCore.CookiePolicy, 2.1.1}", + "Microsoft.AspNetCore.Cors, {Microsoft.AspNetCore.Cors, 2.1.1}", + "Microsoft.AspNetCore.Cryptography.Internal, {Microsoft.AspNetCore.Cryptography.Internal, 2.1.1}", + "Microsoft.AspNetCore.Cryptography.KeyDerivation, {Microsoft.AspNetCore.Cryptography.KeyDerivation, 2.1.1}", + "Microsoft.AspNetCore.DataProtection, {Microsoft.AspNetCore.DataProtection, 2.1.1}", + "Microsoft.AspNetCore.DataProtection.Abstractions, {Microsoft.AspNetCore.DataProtection.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.DataProtection.Extensions, {Microsoft.AspNetCore.DataProtection.Extensions, 2.1.1}", + "Microsoft.AspNetCore.Diagnostics, {Microsoft.AspNetCore.Diagnostics, 2.1.1}", + "Microsoft.AspNetCore.Diagnostics.Abstractions, {Microsoft.AspNetCore.Diagnostics.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore, {Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore, 2.1.1}", + "Microsoft.AspNetCore.HostFiltering, {Microsoft.AspNetCore.HostFiltering, 2.1.1}", + "Microsoft.AspNetCore.Hosting, {Microsoft.AspNetCore.Hosting, 2.1.1}", + "Microsoft.AspNetCore.Hosting.Abstractions, {Microsoft.AspNetCore.Hosting.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Hosting.Server.Abstractions, {Microsoft.AspNetCore.Hosting.Server.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Html.Abstractions, {Microsoft.AspNetCore.Html.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Http, {Microsoft.AspNetCore.Http, 2.1.1}", + "Microsoft.AspNetCore.Http.Abstractions, {Microsoft.AspNetCore.Http.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Http.Connections, {Microsoft.AspNetCore.Http.Connections, 1.0.1}", + "Microsoft.AspNetCore.Http.Connections.Common, {Microsoft.AspNetCore.Http.Connections.Common, 1.0.1}", + "Microsoft.AspNetCore.Http.Extensions, {Microsoft.AspNetCore.Http.Extensions, 2.1.1}", + "Microsoft.AspNetCore.Http.Features, {Microsoft.AspNetCore.Http.Features, 2.1.1}", + "Microsoft.AspNetCore.HttpOverrides, {Microsoft.AspNetCore.HttpOverrides, 2.1.1}", + "Microsoft.AspNetCore.HttpsPolicy, {Microsoft.AspNetCore.HttpsPolicy, 2.1.1}", + "Microsoft.AspNetCore.Identity, {Microsoft.AspNetCore.Identity, 2.1.1}", + "Microsoft.AspNetCore.Identity.EntityFrameworkCore, {Microsoft.AspNetCore.Identity.EntityFrameworkCore, 2.1.1}", + "Microsoft.AspNetCore.Identity.UI, {Microsoft.AspNetCore.Identity.UI, 2.1.1}", + "Microsoft.AspNetCore.Identity.UI.Views, {Microsoft.AspNetCore.Identity.UI, 2.1.1}", + "Microsoft.AspNetCore.JsonPatch, {Microsoft.AspNetCore.JsonPatch, 2.1.1}", + "Microsoft.AspNetCore.Localization, {Microsoft.AspNetCore.Localization, 2.1.1}", + "Microsoft.AspNetCore.Localization.Routing, {Microsoft.AspNetCore.Localization.Routing, 2.1.1}", + "Microsoft.AspNetCore.MiddlewareAnalysis, {Microsoft.AspNetCore.MiddlewareAnalysis, 2.1.1}", + "Microsoft.AspNetCore.Mvc, {Microsoft.AspNetCore.Mvc, 2.1.1}", + "Microsoft.AspNetCore.Mvc.Abstractions, {Microsoft.AspNetCore.Mvc.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Mvc.ApiExplorer, {Microsoft.AspNetCore.Mvc.ApiExplorer, 2.1.1}", + "Microsoft.AspNetCore.Mvc.Core, {Microsoft.AspNetCore.Mvc.Core, 2.1.1}", + "Microsoft.AspNetCore.Mvc.Cors, {Microsoft.AspNetCore.Mvc.Cors, 2.1.1}", + "Microsoft.AspNetCore.Mvc.DataAnnotations, {Microsoft.AspNetCore.Mvc.DataAnnotations, 2.1.1}", + "Microsoft.AspNetCore.Mvc.Formatters.Json, {Microsoft.AspNetCore.Mvc.Formatters.Json, 2.1.1}", + "Microsoft.AspNetCore.Mvc.Formatters.Xml, {Microsoft.AspNetCore.Mvc.Formatters.Xml, 2.1.1}", + "Microsoft.AspNetCore.Mvc.Localization, {Microsoft.AspNetCore.Mvc.Localization, 2.1.1}", + "Microsoft.AspNetCore.Mvc.Razor, {Microsoft.AspNetCore.Mvc.Razor, 2.1.1}", + "Microsoft.AspNetCore.Mvc.Razor.Extensions, {Microsoft.AspNetCore.Mvc.Razor.Extensions, 2.1.1}", + "Microsoft.AspNetCore.Mvc.RazorPages, {Microsoft.AspNetCore.Mvc.RazorPages, 2.1.1}", + "Microsoft.AspNetCore.Mvc.TagHelpers, {Microsoft.AspNetCore.Mvc.TagHelpers, 2.1.1}", + "Microsoft.AspNetCore.Mvc.ViewFeatures, {Microsoft.AspNetCore.Mvc.ViewFeatures, 2.1.1}", + "Microsoft.AspNetCore.NodeServices, {Microsoft.AspNetCore.NodeServices, 2.1.1}", + "Microsoft.AspNetCore.Owin, {Microsoft.AspNetCore.Owin, 2.1.1}", + "Microsoft.AspNetCore.Razor, {Microsoft.AspNetCore.Razor, 2.1.1}", + "Microsoft.AspNetCore.Razor.Language, {Microsoft.AspNetCore.Razor.Language, 2.1.1}", + "Microsoft.AspNetCore.Razor.Runtime, {Microsoft.AspNetCore.Razor.Runtime, 2.1.1}", + "Microsoft.AspNetCore.ResponseCaching, {Microsoft.AspNetCore.ResponseCaching, 2.1.1}", + "Microsoft.AspNetCore.ResponseCaching.Abstractions, {Microsoft.AspNetCore.ResponseCaching.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.ResponseCompression, {Microsoft.AspNetCore.ResponseCompression, 2.1.1}", + "Microsoft.AspNetCore.Rewrite, {Microsoft.AspNetCore.Rewrite, 2.1.1}", + "Microsoft.AspNetCore.Routing, {Microsoft.AspNetCore.Routing, 2.1.1}", + "Microsoft.AspNetCore.Routing.Abstractions, {Microsoft.AspNetCore.Routing.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Server.HttpSys, {Microsoft.AspNetCore.Server.HttpSys, 2.1.1}", + "Microsoft.AspNetCore.Server.IISIntegration, {Microsoft.AspNetCore.Server.IISIntegration, 2.1.1}", + "Microsoft.AspNetCore.Server.Kestrel, {Microsoft.AspNetCore.Server.Kestrel, 2.1.1}", + "Microsoft.AspNetCore.Server.Kestrel.Core, {Microsoft.AspNetCore.Server.Kestrel.Core, 2.1.1}", + "Microsoft.AspNetCore.Server.Kestrel.Https, {Microsoft.AspNetCore.Server.Kestrel.Https, 2.1.1}", + "Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions, {Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions, 2.1.1}", + "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets, {Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets, 2.1.1}", + "Microsoft.AspNetCore.Session, {Microsoft.AspNetCore.Session, 2.1.1}", + "Microsoft.AspNetCore.SignalR, {Microsoft.AspNetCore.SignalR, 1.0.1}", + "Microsoft.AspNetCore.SignalR.Common, {Microsoft.AspNetCore.SignalR.Common, 1.0.1}", + "Microsoft.AspNetCore.SignalR.Core, {Microsoft.AspNetCore.SignalR.Core, 1.0.1}", + "Microsoft.AspNetCore.SignalR.Protocols.Json, {Microsoft.AspNetCore.SignalR.Protocols.Json, 1.0.1}", + "Microsoft.AspNetCore.SpaServices, {Microsoft.AspNetCore.SpaServices, 2.1.1}", + "Microsoft.AspNetCore.SpaServices.Extensions, {Microsoft.AspNetCore.SpaServices.Extensions, 2.1.1}", + "Microsoft.AspNetCore.StaticFiles, {Microsoft.AspNetCore.StaticFiles, 2.1.1}", + "Microsoft.AspNetCore.WebSockets, {Microsoft.AspNetCore.WebSockets, 2.1.1}", + "Microsoft.AspNetCore.WebUtilities, {Microsoft.AspNetCore.WebUtilities, 2.1.1}", + "Microsoft.CodeAnalysis, {Microsoft.CodeAnalysis.Common, 2.8.0}", + "Microsoft.CodeAnalysis.CSharp, {Microsoft.CodeAnalysis.CSharp, 2.8.0}", + "Microsoft.CodeAnalysis.Razor, {Microsoft.CodeAnalysis.Razor, 2.1.1}", + "Microsoft.DotNet.PlatformAbstractions, {Microsoft.DotNet.PlatformAbstractions, 2.1.0}", + "Microsoft.EntityFrameworkCore, {Microsoft.EntityFrameworkCore, 2.1.1}", + "Microsoft.EntityFrameworkCore.Abstractions, {Microsoft.EntityFrameworkCore.Abstractions, 2.1.1}", + "Microsoft.EntityFrameworkCore.InMemory, {Microsoft.EntityFrameworkCore.InMemory, 2.1.1}", + "Microsoft.EntityFrameworkCore.Relational, {Microsoft.EntityFrameworkCore.Relational, 2.1.1}", + "Microsoft.EntityFrameworkCore.SqlServer, {Microsoft.EntityFrameworkCore.SqlServer, 2.1.1}", + "Microsoft.Extensions.Caching.Abstractions, {Microsoft.Extensions.Caching.Abstractions, 2.1.1}", + "Microsoft.Extensions.Caching.Memory, {Microsoft.Extensions.Caching.Memory, 2.1.1}", + "Microsoft.Extensions.Caching.SqlServer, {Microsoft.Extensions.Caching.SqlServer, 2.1.1}", + "Microsoft.Extensions.Configuration, {Microsoft.Extensions.Configuration, 2.1.1}", + "Microsoft.Extensions.Configuration.Abstractions, {Microsoft.Extensions.Configuration.Abstractions, 2.1.1}", + "Microsoft.Extensions.Configuration.Binder, {Microsoft.Extensions.Configuration.Binder, 2.1.1}", + "Microsoft.Extensions.Configuration.CommandLine, {Microsoft.Extensions.Configuration.CommandLine, 2.1.1}", + "Microsoft.Extensions.Configuration.EnvironmentVariables, {Microsoft.Extensions.Configuration.EnvironmentVariables, 2.1.1}", + "Microsoft.Extensions.Configuration.FileExtensions, {Microsoft.Extensions.Configuration.FileExtensions, 2.1.1}", + "Microsoft.Extensions.Configuration.Ini, {Microsoft.Extensions.Configuration.Ini, 2.1.1}", + "Microsoft.Extensions.Configuration.Json, {Microsoft.Extensions.Configuration.Json, 2.1.1}", + "Microsoft.Extensions.Configuration.KeyPerFile, {Microsoft.Extensions.Configuration.KeyPerFile, 2.1.1}", + "Microsoft.Extensions.Configuration.UserSecrets, {Microsoft.Extensions.Configuration.UserSecrets, 2.1.1}", + "Microsoft.Extensions.Configuration.Xml, {Microsoft.Extensions.Configuration.Xml, 2.1.1}", + "Microsoft.Extensions.DependencyInjection, {Microsoft.Extensions.DependencyInjection, 2.1.1}", + "Microsoft.Extensions.DependencyInjection.Abstractions, {Microsoft.Extensions.DependencyInjection.Abstractions, 2.1.1}", + "Microsoft.Extensions.DependencyModel, {Microsoft.Extensions.DependencyModel, 2.1.0}", + "Microsoft.Extensions.DiagnosticAdapter, {Microsoft.Extensions.DiagnosticAdapter, 2.1.0}", + "Microsoft.Extensions.FileProviders.Abstractions, {Microsoft.Extensions.FileProviders.Abstractions, 2.1.1}", + "Microsoft.Extensions.FileProviders.Composite, {Microsoft.Extensions.FileProviders.Composite, 2.1.1}", + "Microsoft.Extensions.FileProviders.Embedded, {Microsoft.Extensions.FileProviders.Embedded, 2.1.1}", + "Microsoft.Extensions.FileProviders.Physical, {Microsoft.Extensions.FileProviders.Physical, 2.1.1}", + "Microsoft.Extensions.FileSystemGlobbing, {Microsoft.Extensions.FileSystemGlobbing, 2.1.1}", + "Microsoft.Extensions.Hosting, {Microsoft.Extensions.Hosting, 2.1.1}", + "Microsoft.Extensions.Hosting.Abstractions, {Microsoft.Extensions.Hosting.Abstractions, 2.1.1}", + "Microsoft.Extensions.Http, {Microsoft.Extensions.Http, 2.1.1}", + "Microsoft.Extensions.Identity.Core, {Microsoft.Extensions.Identity.Core, 2.1.1}", + "Microsoft.Extensions.Identity.Stores, {Microsoft.Extensions.Identity.Stores, 2.1.1}", + "Microsoft.Extensions.Localization, {Microsoft.Extensions.Localization, 2.1.1}", + "Microsoft.Extensions.Localization.Abstractions, {Microsoft.Extensions.Localization.Abstractions, 2.1.1}", + "Microsoft.Extensions.Logging, {Microsoft.Extensions.Logging, 2.1.1}", + "Microsoft.Extensions.Logging.Abstractions, {Microsoft.Extensions.Logging.Abstractions, 2.1.1}", + "Microsoft.Extensions.Logging.Configuration, {Microsoft.Extensions.Logging.Configuration, 2.1.1}", + "Microsoft.Extensions.Logging.Console, {Microsoft.Extensions.Logging.Console, 2.1.1}", + "Microsoft.Extensions.Logging.Debug, {Microsoft.Extensions.Logging.Debug, 2.1.1}", + "Microsoft.Extensions.Logging.EventSource, {Microsoft.Extensions.Logging.EventSource, 2.1.1}", + "Microsoft.Extensions.Logging.TraceSource, {Microsoft.Extensions.Logging.TraceSource, 2.1.1}", + "Microsoft.Extensions.ObjectPool, {Microsoft.Extensions.ObjectPool, 2.1.1}", + "Microsoft.Extensions.Options, {Microsoft.Extensions.Options, 2.1.1}", + "Microsoft.Extensions.Options.ConfigurationExtensions, {Microsoft.Extensions.Options.ConfigurationExtensions, 2.1.1}", + "Microsoft.Extensions.Primitives, {Microsoft.Extensions.Primitives, 2.1.1}", + "Microsoft.Extensions.WebEncoders, {Microsoft.Extensions.WebEncoders, 2.1.1}", + "Microsoft.IdentityModel.Logging, {Microsoft.IdentityModel.Logging, 5.2.0}", + "Microsoft.IdentityModel.Protocols, {Microsoft.IdentityModel.Protocols, 5.2.0}", + "Microsoft.IdentityModel.Protocols.OpenIdConnect, {Microsoft.IdentityModel.Protocols.OpenIdConnect, 5.2.0}", + "Microsoft.IdentityModel.Protocols.WsFederation, {Microsoft.IdentityModel.Protocols.WsFederation, 5.2.0}", + "Microsoft.IdentityModel.Tokens, {Microsoft.IdentityModel.Tokens, 5.2.0}", + "Microsoft.IdentityModel.Tokens.Saml, {Microsoft.IdentityModel.Tokens.Saml, 5.2.0}", + "Microsoft.IdentityModel.Xml, {Microsoft.IdentityModel.Xml, 5.2.0}", + "Microsoft.Net.Http.Headers, {Microsoft.Net.Http.Headers, 2.1.1}", + "Microsoft.Win32.Registry, {Microsoft.Win32.Registry, 4.5.0}", + "Newtonsoft.Json, {Newtonsoft.Json, 11.0.2}", + "Newtonsoft.Json.Bson, {Newtonsoft.Json.Bson, 1.0.1}", + "Remotion.Linq, {Remotion.Linq, 2.2.0}", + "System.Data.SqlClient, {System.Data.SqlClient, 4.5.1}", + "System.IdentityModel.Tokens.Jwt, {System.IdentityModel.Tokens.Jwt, 5.2.0}", + "System.Interactive.Async, {System.Interactive.Async, 3.1.1}", + "System.IO.Pipelines, {System.IO.Pipelines, 4.5.0}", + "System.Net.Http.Formatting, {Microsoft.AspNet.WebApi.Client, 5.2.6}", + "System.Net.WebSockets.WebSocketProtocol, {System.Net.WebSockets.WebSocketProtocol, 4.5.1}", + "System.Runtime.CompilerServices.Unsafe, {System.Runtime.CompilerServices.Unsafe, 4.5.1}", + "System.Security.AccessControl, {System.Security.AccessControl, 4.5.0}", + "System.Security.Cryptography.Cng, {System.Security.Cryptography.Cng, 4.5.0}", + "System.Security.Cryptography.Xml, {System.Security.Cryptography.Xml, 4.5.0}", + "System.Security.Permissions, {System.Security.Permissions, 4.5.0}", + "System.Security.Principal.Windows, {System.Security.Principal.Windows, 4.5.0}", + "System.Text.Encodings.Web, {System.Text.Encodings.Web, 4.5.0}", + "System.Threading.Channels, {System.Threading.Channels, 4.5.0}" + ], + "targetFramework": "netcoreapp2.1", + "typeReuseMode": "All" + } +} \ No newline at end of file diff --git a/WCFService/Startup.cs b/WCFService/Startup.cs new file mode 100644 index 0000000000000000000000000000000000000000..1ad8a919c1f43181a9813661523ffcabd3c05dff --- /dev/null +++ b/WCFService/Startup.cs @@ -0,0 +1,47 @@ +п»їusing System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; + +namespace WCFService +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseMvc(); + } + } +} diff --git a/WCFService/WCFService.csproj b/WCFService/WCFService.csproj new file mode 100644 index 0000000000000000000000000000000000000000..2e1c12a3b00a174a0f7daa7b5b3b001503edd236 --- /dev/null +++ b/WCFService/WCFService.csproj @@ -0,0 +1,19 @@ +п»ї<?xml version="1.0" encoding="utf-8"?> +<Project Sdk="Microsoft.NET.Sdk.Web"> + <PropertyGroup> + <TargetFramework>netcoreapp2.1</TargetFramework> + </PropertyGroup> + <ItemGroup> + <Folder Include="wwwroot\" /> + </ItemGroup> + <ItemGroup> + <PackageReference Include="Microsoft.AspNetCore.App" /> + <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" /> + </ItemGroup> + <ItemGroup> + <PackageReference Include="System.ServiceModel.Duplex" Version="4.4.*" /> + <PackageReference Include="System.ServiceModel.Http" Version="4.4.*" /> + <PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.*" /> + <PackageReference Include="System.ServiceModel.Security" Version="4.4.*" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/WCFService/appsettings.Development.json b/WCFService/appsettings.Development.json new file mode 100644 index 0000000000000000000000000000000000000000..e203e9407e74a6b9662aab8fde5d73ae64665f18 --- /dev/null +++ b/WCFService/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/WCFService/appsettings.json b/WCFService/appsettings.json new file mode 100644 index 0000000000000000000000000000000000000000..def9159a7d9403c04a926f64e71ef3ee7c9e4c57 --- /dev/null +++ b/WCFService/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/WCFServiceLibrary/Contract/IUTCTimeService.cs b/WCFServiceLibrary/Contract/IUTCTimeService.cs new file mode 100644 index 0000000000000000000000000000000000000000..2fd07944e94a89cf2761f975fc036d9cbb9016e8 --- /dev/null +++ b/WCFServiceLibrary/Contract/IUTCTimeService.cs @@ -0,0 +1,18 @@ +п»їusing System; +using System.Collections.Generic; +using System.Linq; +using System.ServiceModel; +using System.Text; +using System.Threading.Tasks; + +namespace WCFServiceLibrary.Contract +{ + //контракт + [ServiceContract] + public interface IUTCTimeService + { + [OperationContract] + string GetUTCTimeNow( ); + + } +} diff --git a/WCFServiceLibrary/Properties/AssemblyInfo.cs b/WCFServiceLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..17528fc8819bbbcbe5e00fb7e3347b55c517bf23 --- /dev/null +++ b/WCFServiceLibrary/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +п»їusing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения РѕР± этой СЃР±РѕСЂРєРµ предоставляются следующим набором +// набора атрибутов. Рзмените значения этих атрибутов для изменения сведений, +// связанные СЃРѕ СЃР±РѕСЂРєРѕР№. +[assembly: AssemblyTitle("WCFServiceLibrary")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WCFServiceLibrary")] +[assembly: AssemblyCopyright("Copyright В© 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы РІ этой СЃР±РѕСЂРєРµ невидимыми +// для компонентов COM. Если необходимо обратиться Рє типу РІ этой СЃР±РѕСЂРєРµ через +// COM, задайте атрибуту ComVisible значение TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("288b8e71-2161-439e-96ee-2e088a2830a9")] + +// Сведения Рѕ версии СЃР±РѕСЂРєРё состоят РёР· указанных ниже четырех значений: +// +// РћСЃРЅРѕРІРЅРѕР№ номер версии +// Дополнительный номер версии +// Номер СЃР±РѕСЂРєРё +// Редакция +// +// Можно задать РІСЃРµ значения или принять номера СЃР±РѕСЂРєРё Рё редакции РїРѕ умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WCFServiceLibrary/Service/UTCTimeService.cs b/WCFServiceLibrary/Service/UTCTimeService.cs new file mode 100644 index 0000000000000000000000000000000000000000..388d4cb9baef30fa4f34be93369fdec9101ed7bf --- /dev/null +++ b/WCFServiceLibrary/Service/UTCTimeService.cs @@ -0,0 +1,18 @@ +п»їusing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WCFServiceLibrary.Contract; + +namespace WCFServiceLibrary.Service +{ + public class UTCTimeService : IUTCTimeService + { + //реализация контракта + public string GetUTCTimeNow() + { + return DateTime.UtcNow.ToString(); + } + } +} diff --git a/WCFServiceLibrary/WCFServiceLibrary.csproj b/WCFServiceLibrary/WCFServiceLibrary.csproj new file mode 100644 index 0000000000000000000000000000000000000000..134fb873d5a638927567dfad691522b0ff3d738c --- /dev/null +++ b/WCFServiceLibrary/WCFServiceLibrary.csproj @@ -0,0 +1,50 @@ +п»ї<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{288B8E71-2161-439E-96EE-2E088A2830A9}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>WCFServiceLibrary</RootNamespace> + <AssemblyName>WCFServiceLibrary</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <Deterministic>true</Deterministic> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.ServiceModel" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Contract\IUTCTimeService.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Service\UTCTimeService.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project> \ No newline at end of file