Giter Site home page Giter Site logo

corewcf's Introduction

What is CoreWCF?

CoreWCF is a port of the service side of Windows Communication Foundation (WCF) to .NET Core. The goal of this project is to enable existing WCF services to move to .NET Core.

Package Status

The latest released packages can be found at NuGet.org:

Package NuGet Stable Downloads
CoreWCF.ConfigurationManager CoreWCF.ConfigurationManager CoreWCF.ConfigurationManager
CoreWCF.Http CoreWCF.Http CoreWCF.Http
CoreWCF.Kafka CoreWCF.Kafka CoreWCF.Kafka
CoreWCF.Kafka.Client CoreWCF.Kafka.Client CoreWCF.Kafka.Client
CoreWCF.MSMQ CoreWCF.MSMQ CoreWCF.MSMQ
CoreWCF.NetNamedPipe CoreWCF.NetNamedPipe CoreWCF.NetNamedPipe
CoreWCF.NetTcp CoreWCF.NetTcp CoreWCF.NetTcp
CoreWCF.Primitives CoreWCF.Primitives CoreWCF.Primitives
CoreWCF.RabbitMQ CoreWCF.RabbitMQ CoreWCF.RabbitMQ
CoreWCF.RabbitMQ.Client CoreWCF.RabbitMQ.Client CoreWCF.RabbitMQ.Client
CoreWCF.Templates CoreWCF.Templates CoreWCF.Templates
CoreWCF.UnixDomainSocket CoreWCF.UnixDomainSocket CoreWCF.UnixDomainSocket
CoreWCF.WebHttp CoreWCF.WebHttp CoreWCF.WebHttp

Community Packages

The latest CoreWCF extension released packages from community can be found at NuGet.org:

Package NuGet Stable Downloads
AWS.CoreWCF.Extensions AWS.CoreWCF.Extensions AWS.CoreWCF.Extensions
AWS.WCF.Extensions AWS.WCF.Extensions AWS.WCF.Extensions

Code Quality

SonarCloud

Announcements

To keep up to date on what's going on with CoreWCF, you can subscribe to the announcements repo to be notified about major changes and other noteworthy announcements.

How do I get started?

  • Install the Nuget packages listed above, either via the Package Manager Console or the UI.
  • See Walkthrough for a step by step guide to creating a service and referencing it from a client project.
  • See Testing for running unit and integration tests in your development environment.
  • The Samples repo has examples for multiple scenarios.
  • The Blog has details on the design philosophy and a deep dive into the features are included in each new release.

Use CoreWCF project templates (dotnet CLI or VisualStudio)

  • Install CoreWCF project templates, create a directory for your project and cd inside the directory and initialize your project
dotnet new --install CoreWCF.Templates 
dotnet new corewcf --name MyService
  • CoreWCF Service project template creates a minimal ASP.NET Core web application thats exposes the well-known WCF default service using a BasicHttpBinding. It supports the following arguments:
    • --framework: net6.0 (default), net5.0, netcoreapp3.1, net48, net472 and net462 are valid values.
    • --use-program-main: whether to turn off ASP.NET Core minimal API hosting. This option only affects net6.0 projects as other target require a Startup and a Program class.
    • --no-https: whether to turn off HTTPS and use BasicHttpSecurityMode.None. Default is HTTPS enabled using BasicHttpSecurityMode.Transport.
    • --no-wsdl: whether to turn off WSDL metadata feature.

Development Builds

There are pre-release packages available for development builds of main from a NuGet feed hosted in Azure DevOps. You can download the packages by adding the following package source to your list of feeds.

`https://pkgs.dev.azure.com/dotnet/CoreWCF/_packaging/CoreWCF/nuget/v3/index.json`

If you are using a nuget.config file with only the default nuget.org package source, after adding the CoreWCF feed it would look like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="CoreWCF" value="https://pkgs.dev.azure.com/dotnet/CoreWCF/_packaging/CoreWCF/nuget/v3/index.json" />
  </packageSources>
</configuration>

How do I contribute?

Please see the CONTRIBUTING.md file for details.

License, etc.

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

CoreWCF is Copyright © 2019 .NET Foundation and other contributors under the MIT license.

.NET Foundation

This project is supported by the .NET Foundation.

corewcf's People

Contributors

absinghal avatar afifi-ins avatar arontsang avatar biroj avatar birojnayak avatar damirainullin avatar danielcrenna avatar danielku15 avatar g7ed6e avatar gvkries avatar imcarolwang avatar joeldavidlang avatar jonathanhopedmrc avatar jonlouie avatar lukedukeus avatar mconnew avatar nathan-roe-adesa avatar nmangue avatar nschonni avatar olofblomqvist avatar ovebastiansen avatar samsp-msft avatar tallalnparis4ev avatar tibor19 avatar treit avatar v-fangfc avatar vitahapo avatar vortechs avatar willaimyou avatar zhaodongtian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

corewcf's Issues

System.PlatformNotSupportedException: Server implementation is not supported

I published the NetCoreServer and NetCoreClient to linux binaries. The development machine is windows 10 os. I took the binaries to a my ubuntu machine and tried to launch them there. Initially, the server launches ok but once I launch the client I get the following errors:

[Server]
(xenial)wbuckner@localhost:~/Documents/NetCoreServer/netcoreapp2.2
/linux-x64/publish$ ./NetCoreServer
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Overriding address(es) 'http://localhost:8080'. Binding to endpoints defined in UseKestrel() instead.
Hosting environment: Production
Content root path: /home/wbuckner/Documents/NetCoreServer/netcoreapp2.2/linux-x64/publish
Now listening on: http://localhost:8080
Now listening on: http://0.0.0.0:8808
Application started. Press Ctrl+C to shut down.
crit: Microsoft.AspNetCore.Server.Kestrel[0]
ConnectionDispatcher.Execute() 0HLP8L48PMSGK
System.PlatformNotSupportedException: Server implementation is not supported
at System.Net.Security.NegotiateStreamPal.AcquireCredentialsHandle(String package, Boolean isServer, NetworkCredential credential)
at System.Net.Security.NegotiateStreamPal.AcquireDefaultCredential(String package, Boolean isServer)
at System.Net.NTAuthentication.Initialize(Boolean isServer, String package, NetworkCredential credential, String spn, ContextFlagsPal requestedContextFlags, ChannelBinding channelBinding)
at System.Net.Security.NegoState.ValidateCreateContext(String package, Boolean isServer, NetworkCredential credential, String servicePrincipalName, ChannelBinding channelBinding, ProtectionLevel protectionLevel, TokenImpersonationLevel impersonationLevel)
at System.Net.Security.NegoState.ValidateCreateContext(String package, NetworkCredential credential, String servicePrincipalName, ExtendedProtectionPolicy policy, ProtectionLevel protectionLevel, TokenImpersonationLevel impersonationLevel)
at System.Net.Security.NegotiateStream.BeginAuthenticateAsServer(NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel, AsyncCallback asyncCallback, Object asyncState)
at System.Net.Security.NegotiateStream.BeginAuthenticateAsServer(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel, AsyncCallback asyncCallback, Object asyncState)
at System.Threading.Tasks.TaskFactory1.FromAsyncImpl[TArg1,TArg2,TArg3](Func6 beginMethod, Func2 endFunction, Action1 endAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func6 beginMethod, Action1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state)
at System.Net.Security.NegotiateStream.AuthenticateAsServerAsync(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel)
at CoreWCF.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.OnAcceptUpgradeAsync(Stream stream) in C:\CoreWCF\src\CoreWCF.Primitives\src\CoreWCF\Channels\WindowsStreamSecurityUpgradeProvider.cs:line 145
at CoreWCF.Channels.StreamSecurityUpgradeAcceptorBase.AcceptUpgradeAsync(Stream stream) in C:\CoreWCF\src\CoreWCF.Primitives\src\CoreWCF\Channels\StreamSecurityUpgradeAcceptorBase.cs:line 28
at CoreWCF.Channels.Framing.ServerFramingDuplexSessionMiddleware.UpgradeConnectionAsync(FramingConnection connection) in C:\CoreWCF\src\CoreWCF.NetTcp\src\CoreWCF\Channels\Framing\ServerFramingDuplexSessionMiddleware.cs:line 155
at CoreWCF.Channels.Framing.ServerFramingDuplexSessionMiddleware.OnConnectedAsync(FramingConnection connection) in C:\CoreWCF\src\CoreWCF.NetTcp\src\CoreWCF\Channels\Framing\ServerFramingDuplexSessionMiddleware.cs:line 65
at CoreWCF.Channels.Framing.NetMessageFramingConnectionHandler.<>c__DisplayClass4_1.<b__5>d.MoveNext() in C:\CoreWCF\src\CoreWCF.NetTcp\src\CoreWCF\Channels\Framing\NetMessageFramingConnectionHandler.cs:line 39
--- End of stack trace from previous location where exception was thrown ---
at CoreWCF.Channels.Framing.DuplexFramingMiddleware.OnConnectedAsync(FramingConnection connection) in C:\CoreWCF\src\CoreWCF.NetTcp\src\CoreWCF\Channels\Framing\DuplexFramingMiddleware.cs:line 68
at CoreWCF.Configuration.MapMiddleware.Invoke(FramingConnection connection) in C:\CoreWCF\src\CoreWCF.NetTcp\src\CoreWCF\Configuration\MapMiddleware.cs:line 43
at CoreWCF.Channels.Framing.FramingModeHandshakeMiddleware.OnConnectedAsync(FramingConnection connection) in C:\CoreWCF\src\CoreWCF.NetTcp\src\CoreWCF\Channels\Framing\FramingModeHandshakeMiddleware.cs:line 22
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.ConnectionDispatcher.Execute(KestrelConnection connection)

[Client]
(xenial)wbuckner@localhost:~/Documents/NetCoreClient/netcoreapp2.2
/linux-x64/publish$ ./NetCoreClient

Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException: Authentication failed, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ComponentModel.Win32Exception: GSSAPI operation failed with error - An invalid status code was supplied (SPNEGO cannot find mechanisms to negotiate).
--- End of inner exception stack trace ---
at System.Net.Security.NegoState.StartSendAuthResetSignal(LazyAsyncResult lazyResult, Byte[] message, Exception exception)
at System.Net.Security.NegoState.StartSendBlob(Byte[] message, LazyAsyncResult lazyResult)
at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.NegotiateStream.BeginAuthenticateAsClient(NetworkCredential credential, ChannelBinding binding, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, Object asyncState)
at System.Net.Security.NegotiateStream.BeginAuthenticateAsClient(NetworkCredential credential, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, Object asyncState)
at System.Net.Security.NegotiateStream.<>c__DisplayClass27_0.b__0(AsyncCallback callback, Object state)
at System.Threading.Tasks.TaskFactory1.FromAsyncImpl(Func3 beginMethod, Func2 endFunction, Action1 endAction, Object state, TaskCreationOptions creationOptions)
at System.Net.Security.NegotiateStream.AuthenticateAsClientAsync(NetworkCredential credential, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgradeAsync(Stream stream, OutWrapper1 remoteSecurity) --- End of inner exception stack trace --- at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgradeAsync(Stream stream, OutWrapper1 remoteSecurity)
at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorBase.InitiateUpgradeAsync(Stream stream)
at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgradeAsync(StreamUpgradeInitiator upgradeInitiator, OutWrapper1 connectionWrapper, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeSpan timeout) at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreambleAsync(IConnection connection, ArraySegment1 preamble, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnectionAsync(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpenAsync(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.OnOpenAsyncInternal(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.System.ServiceModel.IAsyncCommunicationObject.OpenAsync(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.OpenAsyncInternal(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.Runtime.TaskHelpers.CallActionAsync[TArg](Action`1 action, TArg argument)
at System.ServiceModel.Channels.CommunicationObject.OpenOtherAsync(ICommunicationObject other, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpenAsync(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.OnOpenAsyncInternal(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.System.ServiceModel.IAsyncCommunicationObject.OpenAsync(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.OpenAsyncInternal(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.System.ServiceModel.ICommunicationObject.Open()
at NetCoreClient.Program.Main(String[] args) in C:\CoreWCF\src\Samples\NetCoreClient\Program.cs:line 14
Aborted (core dumped)

Got an exception when bind app to "http://*:port"

When I try to bind Kestrel app to url "http://*:port" I've got next exception:

System.UriFormatException:` "Invalid URI: The hostname could not be parsed."
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at CoreWCF.Channels.ServiceModelHttpMiddleware.BuildBranch(IApplicationBuilder app, IServiceBuilder serviceBuilder, IDispatcherBuilder dispatcherBuilder) in C:\CS\CloudSmetaSolutionCore\CoreWcfProjects\CoreWCF.Http\src\CoreWCF\Channels\ServiceModelHttpMiddleware.cs:line 37
at CoreWCF.Channels.ServiceModelHttpMiddleware..ctor(RequestDelegate next, IApplicationBuilder app, IServiceBuilder serviceBuilder, IDispatcherBuilder dispatcherBuilder) in C:\CS\CloudSmetaSolutionCore\CoreWcfProjects\CoreWCF.Http\src\CoreWCF\Channels\ServiceModelHttpMiddleware.cs:line 23

NetCoreServer build has errors cannot find IWebHostBuilder, IServiceCollection, IApplicationBuilder

I pulled down the latest source today in a zip file, extracted and tried to build I had error not finding some types: IWebHostBuilder, IServiceCollection, IApplicationBuilder. This might be related to issue 79

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'IWebHostBuilder' could not be found (are you missing a using directive or an assembly reference?) NetCoreServer C:\Repository\CoreWCF\CoreWCF-master\src\Samples\NetCoreServer\Program.cs 17 Active
Error CS0246 The type or namespace name 'IServiceCollection' could not be found (are you missing a using directive or an assembly reference?) NetCoreServer C:\Repository\CoreWCF\CoreWCF-master\src\Samples\NetCoreServer\Startup.cs 13 Active
Error CS0246 The type or namespace name 'IApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?) NetCoreServer C:\Repository\CoreWCF\CoreWCF-master\src\Samples\NetCoreServer\Startup.cs 18 Active

Add Azure Pipelines for CI

Would be good to have the tests run on PRs to make sure nothing is breaking. Since this is a OSS project, it should be able to leverage the free offering

Can I combine net.tcp and mvc on the same port?

I'm really excited for this project because WCF is currently the only major thing holding our server side back from netcore.

We have the requirement for 1) client-callbacks, which eliminates REST, and 2) net40 clients, which eliminates gRPC (also, as gRPC is based on HTTP/2, there seem to be a lot of issues with firewalls, proxies, forward proxies, ...).


I know you state

Please note that right now, this port is not production ready. We suggest waiting until there are release packages available before using WCF in a production enivronment.

but I'd like to get a proof of concept up as soon as possible, if that is feasible in the current state.


I'm currently wrapping my head around how to customize the ServiceHost, especially the Credentials property to set the server certificate and client options.

As I understand it from scanning the code, I have to create a IServiceBehavior and register that in the IServiceCollection of asp.net core. Then you will call me back after you have instantiated the ServiceHostBase.

Will play around a bit and maybe ask more concrete questions about that later.


My main question is:

Currently we use asp.net core 2.x with .net full framework and self hosted WCF.

This means HTTP runs on port 80, self hosted WCF (net.tcp) runs on a second port.

As CoreWCF is also based on Kestrel, is it possible to run both WCF (net.tcp binding) and the normal HTTP MiddleWares (mvc, swagger, some custom ones) in the same Kestrel instance and on the same port (80)?

Or do I have to spin up a second Kestrel instance on a second port just for WCF?

If the answer is yes, does that also work when hosted in IIS? Does it work when hosted in Azure App Services?

Having to use two ports has always been a little bit of a pain point, and blocked us from using Azure App Services, for example.

Thank you!

Cannot build project

I downloaded the source and try to build the project so I experiment with the libraries.
Building the solution or a single project failed with this error log:

1>------ Build started: Project: CoreWCF.Primitives, Configuration: Debug Any CPU ------
1>Resource File Name = C:\Projects\CoreWCF\src\CoreWCF.Primitives\src/Resources/Strings.resx
1>C:\Projects\CoreWCF\src\Common\src\CoreWCF\ProtocolExceptionHelper.cs(18,48,18,76): error CS0117: 'SR' does not contain a definition for 'ReceiveShutdownReturnedFault'
1>C:\Projects\CoreWCF\src\Common\src\CoreWCF\ProtocolExceptionHelper.cs(23,48,23,81): error CS0117: 'SR' does not contain a definition for 'ReceiveShutdownReturnedLargeFault'
1>C:\Projects\CoreWCF\src\Common\src\CoreWCF\ProtocolExceptionHelper.cs(29,44,29,74): error CS0117: 'SR' does not contain a definition for 'ReceiveShutdownReturnedMessage'
1>CoreWCF\Channels\AddressHeader.cs(115,109,115,131): error CS0117: 'SR' does not contain a definition for 'ExpectedElementMissing'
1>CoreWCF\Dispatcher\XmlSerializerOperationFormatter.cs(29,118,29,143): error CS0117: 'SR' does not contain a definition for 'SFxDocEncodedNotSupported'
1>CoreWCF\Collections\Generic\KeyedByTypeCollection.cs(106,105,106,123): error CS0117: 'SR' does not contain a definition for 'DuplicateBehavior1'
1>CoreWCF\Collections\Generic\SynchronizedCollection.cs(84,66,84,84): error CS0117: 'SR' does not contain a definition for 'ValueMustBeInRange'
1>CoreWCF\XmlUtil.cs(25,95,25,118): error CS0117: 'SR' does not contain a definition for 'XmlLangAttributeMissing'
1>CoreWCF\Dispatcher\EndpointDispatcher.cs(19,13,19,22): warning CS0649: Field 'EndpointDispatcher.listenUri' is never assigned to, and will always have its default value null
1>CoreWCF\Dispatcher\DuplexChannelBinder.cs(17,33,17,43): warning CS0649: Field 'DuplexChannelBinder.correlator' is never assigned to, and will always have its default value null
1>CoreWCF\Dispatcher\ChannelDispatcher.cs(35,14,35,21): warning CS0169: The field 'ChannelDispatcher.session' is never used
1>CoreWCF\ServiceHostBase.cs(36,13,36,22): warning CS0169: The field 'ServiceHostBase.busyCount' is never used
1>CoreWCF\Dispatcher\ChannelDispatcher.cs(41,14,41,38): warning CS0169: The field 'ChannelDispatcher.performDefaultCloseInput' is never used
1>CoreWCF\ServiceHostBase.cs(39,68,39,90): warning CS0067: The event 'ServiceHostBase.UnknownMessageReceived' is never used
1>CoreWCF\Dispatcher\ChannelDispatcher.cs(23,25,23,29): warning CS0649: Field 'ChannelDispatcher.host' is never assigned to, and will always have its default value null
1>CoreWCF\Dispatcher\ChannelDispatcher.cs(19,55,19,67): warning CS0649: Field 'ChannelDispatcher.addressTable' is never assigned to, and will always have its default value null
1>CoreWCF\ServiceHostBase.cs(32,28,32,47): warning CS0169: The field 'ServiceHostBase.readOnlyCredentials' is never used
1>CoreWCF\ServiceHostBase.cs(35,82,35,106): warning CS0169: The field 'ServiceHostBase.endpointsByListenUriInfo' is never used
1>CoreWCF\Dispatcher\ChannelDispatcher.cs(40,18,40,36): warning CS0169: The field 'ChannelDispatcher.transactionTimeout' is never used
1>CoreWCF\Description\ServiceDescription.cs(18,50,18,71): warning CS0169: The field 'ServiceDescription._implementedContracts' is never used
1>CoreWCF\Dispatcher\DispatchRuntime.cs(51,14,51,29): warning CS0649: Field 'DispatchRuntime.preserveMessage' is never assigned to, and will always have its default value false
1>CoreWCF\Description\ServiceDescription.cs(19,37,19,56): warning CS0169: The field 'ServiceDescription._reflectedContracts' is never used
1>CoreWCF\Channels\StreamSecurityUpgradeAcceptorBase.cs(13,14,13,30): warning CS0649: Field 'StreamSecurityUpgradeAcceptorBase.securityUpgraded' is never assigned to, and will always have its default value false
1>CoreWCF\Channels\ServiceChannel.cs(25,36,25,53): warning CS0649: Field 'ServiceChannel.channelDispatcher' is never assigned to, and will always have its default value null
1>CoreWCF\ServiceHostObjectModel.cs(15,26,15,44): warning CS0169: The field 'ServiceHostObjectModel<TService>._singletonInstance' is never used
1>Done building project "CoreWCF.Primitives.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

There are a lot more ''SR' does not contain a definition for 'X'' messages, for readability I removed most of them.

I've noticed the .props and .targets files in the root of the project, but I'm not familiar with those files and can't find where those files are used.

Any chance you could explain how I could build the project?

NetCoreClient throws exception "type is not a ServiceContract"

I add a small service to NetCoreClient and NetCoreService, when the service factory is created from the NetCoreClient

var factory = new ChannelFactory<ISchedulerService>(new BasicHttpBinding(), new EndpointAddress("http://localhost:8080/basichttp"));

an exception is thrown with the message:

Attempted to get contract type for ISchedulerService, but that type is not a ServiceContract, nor does it inherit a ServiceContract.

Source=System.Private.ServiceModel
StackTrace:
at System.ServiceModel.Description.ServiceReflector.GetContractTypeAndAttribute(Type interfaceType, ServiceContractAttribute& contractAttribute)
at System.ServiceModel.Description.TypeLoader.LoadContractDescriptionHelper(Type contractType, Type serviceType, Object serviceImplementation)
at System.ServiceModel.ChannelFactory1.CreateDescription() at System.ServiceModel.ChannelFactory.InitializeEndpoint(Binding binding, EndpointAddress address) at System.ServiceModel.ChannelFactory1..ctor(Binding binding, EndpointAddress remoteAddress)
at NetCoreClient.Program.Main(String[] args) in C:\Github\CoreWCF\src\Samples\NetCoreClient\Program.cs:line 23

To do this I added a netstandard 2.0 library TaskLibrary to CoreWCFWithSamples.sln. Then I added a definition for two types:

ISchedulerService

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;

using CoreWCF;

namespace TaskLibrary
{

    [ServiceContract]
    [ServiceKnownType ( typeof ( TaskTypes ) )]

    public interface ISchedulerService
    {
        #region Methods

        [OperationContract]
        List<TaskTypes> GetSupportedTaskTypes  ();

        #endregion
    }
}

TaskTypes

using System;
using System.Collections.Generic;
using System.Text;

namespace TaskLibrary
{
    public enum TaskTypes
    {
        ManualTask,
        AutoTask,
        RepetitiveTask

    }
}

Next I added TaskLibrary references to NetCoreClient and NetCoreServer.

To NetCoreServer startup.cs the Configure code was modified to:

        public void Configure ( IApplicationBuilder app, IHostingEnvironment env )
        {
            app.UseServiceModel ( builder =>
              {
                  builder.AddService<SchedulerService> ();
                  builder.AddServiceEndpoint<SchedulerService, TaskLibrary.ISchedulerService> ( new BasicHttpBinding (), "/basichttp" );
              } );
        }

To NetCoreClient program.cs the Main code was modified as shown below. After NetCoreServer is started up, then NetCoreClient is started and the exception at the start of the post is generated.

What am I doing wrong?

        static void Main(string[] args)
        {
            /*
            var factory = new ChannelFactory<Contract.IEchoService>(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8808/nettcp"));
            factory.Open();
            var channel = factory.CreateChannel();
            ((IClientChannel)channel).Open();
            Console.WriteLine("net.tcp Echo(\"Hello\") => " + channel.Echo("Hello"));
            ((IClientChannel)channel).Close();
            factory.Close();
            */

            
            var factory = new ChannelFactory<ISchedulerService>(new BasicHttpBinding(), new EndpointAddress("http://localhost:8080/basichttp"));
            factory.Open();
            var channel = factory.CreateChannel();
            ((IClientChannel)channel).Open();

            var taskTypes = channel.GetSupportedTaskTypes ();

            //Console.WriteLine("http Echo(\"Hello\") => " + channel.Echo("Hello"));


            ((IClientChannel)channel).Close();
            factory.Close();
            

            Console.WriteLine("Hit enter to exit");
            Console.ReadLine();
        }

Service type does not implement interface argument exception being thrown

I tried to integrate our older services in CoreWCF and I saw the exception:
"Service type SchedulerService does not implement ISchedulerService"
I commented that out and then our next service threw the same exception.
So I added an empty SchedulerService and the ISchedulerService interface to
NetCoreServer example in CoreWCF (and ITask and SecurityToken).

Then I changed Startup.Configure and replaced EchoService with SchedulerService:

    builder.AddService<SchedulerService>();
    builder.AddServiceEndpoint<EchoService, ISchedulerService>(new BasicHttpBinding(), "/basichttp");

and I was able to reproduce the same exception. What am I doing wrong here.

SchedulerService:

using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Threading;

namespace NetCoreServer
{
    public class SchedulerService : ISchedulerService
    {
        #region Constructors
        public SchedulerService ()
        {
        }
        #endregion

        #region ISchedulerService Implementation
        public bool Cancel(Guid taskID, string message, SecurityToken securityToken)
        {
            bool res = false;
            return res;
        }

        public bool Cancel(System.Collections.Generic.List<Guid> tasks, string message, SecurityToken securityToken)
        {
            bool res = false;
            return res;
        }

        public Guid Add(ITask task, SecurityToken securityToken)
        {
            Guid res = Guid.Empty;
            return res;
        }

        public ITask Terminate(Guid taskID, string message, SecurityToken securityToken)
        {
            ITask res = null;
            return res;
        }

        public ITask TerminateByName(string taskName, string message, SecurityToken securityToken)
        {
            ITask res = null;
            return res;
        }

        public bool IsTaskQueued(Guid taskID, SecurityToken securityToken)
        {
            bool res = false;
            return res;
        }

        public bool IsTaskQueuedByName(string taskName, SecurityToken securityToken)
        {
            bool res = false;
            return res;
        }

        public TimeSpan GetMinimumWaitTime(SecurityToken securityToken)
        {
            TimeSpan res = TimeSpan.MaxValue;
            return res;
        }

        public List<ITask> GetTasks(SecurityToken securityToken)
        {
            List<ITask> res = null;
            return res;
        }

        public List<ITask> GetRunningTasks(SecurityToken securityToken)
        {
            List<ITask> res = null;
            return res;
        }

        public List<ITask> GetWaitingTasks(SecurityToken securityToken)
        {
            List<ITask> res = null;
            return res;
        }
        #endregion
    }
}

ISchedulerScervice:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace NetCoreServer
{
    public interface ISchedulerService
    {
        #region Methods
        bool Cancel ( Guid taskID, string message, SecurityToken securityToken );
        bool Cancel ( List<Guid> tasks, string message, SecurityToken securityToken );
        Guid Add ( ITask task, SecurityToken securityToken );
        ITask Terminate ( Guid taskID, string message, SecurityToken securityToken );
        ITask TerminateByName ( string taskName, string message, SecurityToken securityToken );
        bool IsTaskQueued ( Guid taskID, SecurityToken securityToken );
        bool IsTaskQueuedByName( string taskName, SecurityToken securityToken );
        TimeSpan GetMinimumWaitTime ( SecurityToken securityToken );
        List<ITask> GetTasks ( SecurityToken securityToken );
        List<ITask> GetRunningTasks ( SecurityToken securityToken );
        List<ITask> GetWaitingTasks ( SecurityToken securityToken );
        #endregion
    }
}

ITask:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace NetCoreServer
{
    public interface ITask 
    {
        #region Properties
        object Tag { get; set; }
        string ActionName { get; }
        DateTime LastRun { get; set; }
        DateTime NextRun { get; set; }
        TimeSpan Timeout { get; set; }
        TimeSpan RunTime { get; set; }
        TimeSpan WaitTime { get; set; }
        DateTime LastCheck { get; set; }
        Guid ID { get; }
        #endregion
    }
}

SecurityToken:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;

namespace NetCoreServer
{
    public class SecurityToken
    {
        #region Constructors
        public SecurityToken ()
        {
            Id = Guid.NewGuid();
        }
        #endregion

        #region Properties
        public Guid Id { get; set; }
        public object Payload { get; set; }
        #endregion 
    }

    public class BypassToken : SecurityToken
    {}
}

Does this support TransactionFlow?

Hi,

I do not see TransactionFlow attribute in NetTcpBinding. Is this is expected? I see same in .NET Framework. If this is correct, how do I use Transactions from .net standard to call WCF Service? Thanks

         var tcpb = new NetTcpBinding();
                tcpb.**_TransactionFlow_** = true;

Failing miserably to get Postman to POST a SOAP envelope to a Method

Firstly, let me start by saying, I have absolutely no idea what I'm doing really! I'm new to .NET Core and I've never touched MVC. I AM familiar with high-level WCF, creating services and bindings but nothing anywhere near as low-level as this project. So I am delving into things quickly trying to learn as I go along.

So my aim, for this test project, is to build an application that leverages Controllers, but also SOAP. (Yes it's not normal I know, but I just want to give myself an architectural foundation whereby rather than having relatively undocumented web methods into the application, there's a self-describing endpoint that can be maintained/utilised when I'm gone)

Following the examples, I have successfully managed to build and embed CoreWCF into a test project that has it's roots in a standard .NET Core Console Application.

My program startup (for what it's worth) is:

            WebHost.CreateDefaultBuilder(args)
            .UseKestrel(options => { options.ListenLocalhost(8080); })
            .UseUrls("http://localhost:8080")
            .UseNetTcp(8808)
            .UseStartup<Startup>();

The middleware is doing its job, and I'm able to trace requests through to certain points in the CoreWCF project. I'm not really following what's going on, and I'm not going to insult anyone's intelligence by pretending that I do. I realise this is a new project, and that a lot of it probably isn't ready - but I want to do what I can to help move things forward by learning and understanding.

For this issue though, I've been trying to get Postman to return a message from an Operation Contract that has been made to work through a console application.

I'm aware that out-of-the box, the SOAP version is tied to 1.1 (after many hours of trawling through various message samples and error messages, and finding the code in HTTPBinding!)

The service contract I have created, is as follows:

    [ServiceContract]
    public interface ISOAPService
    {
        [OperationContract]
        string GetToken(string username, string passwordHash);
    }

Nothing strenuous at this point!

An example version 1.1 SOAP Message I have made to work 'the best' so far:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
 <soapenv:Header></soapenv:Header>
 <soapenv:Body>
 <GetToken>
	<Username>VorTechS</Username>
	<PasswordHash>abcdefghijkl</PasswordHash>
 </GetToken>
 </soapenv:Body>
</soapenv:Envelope>

I'm assuming the above is a correctly formatted message, with the appropriate request header set to text/xml to specify SOAP 1.1.

The problem is, that the message never gets mapped to associated operation contract. Tracing down as far as I can through the code stack, it's because the message filtering is explicitly trying to find the Action from the Headers collection at this point:

if (pairs[i].filter.Filter2.Match(message)) (line 258 of AndMessageFilterTable.cs)

Okay, so, perhaps I can just add an action?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
 <soapenv:Header>
 		<Action>http://localhost:8080/wcf/GetToken</Action>
</soapenv:Header>
 <soapenv:Body>
 <GetToken>
	<Username>VorTechS</Username>
	<PasswordHash>abcdefghijkl</PasswordHash>
 </GetToken>
 </soapenv:Body>
</soapenv:Envelope>

But this also fails to read an Action element. Tracing through the code again, the code reading the headers, is return 255 at this point:

kind = (HeaderKind)reader.IndexOfLocalName(localNames, version.Addressing.DictionaryNamespace); (line 1317 of MessageHeaders.cs) for the Action element.

So for giggles I modified the Enum, and some associated code to deal with array sizes to get beyond this point only to be met with:

"The incoming message contains a SOAP header representing the WS-Addressing 'Action', yet the HTTP transport is configured with AddressingVersion.None. As a result, the message is being dropped. If this is not desired, then update your HTTP binding to support a different AddressingVersion." which makes sense given the HTTP Binding is explicitly implementing this.

For even more giggles, I implemented a new shell MessageVersion for SOAP11 and Anonymous addressing.

Which was fine, but then this meant the To header was missing, and that's because the code reading the header type for the To element is still returning 255, and so adding it as another Action header.

Is there a way I can construct a SOAP message that will correctly invoke my method out of the box? Or should I keep digging?

Plans to port ServiceHost?

Hi,

Are there any plans for porting the WCF ServiceHost class to CoreWCF? From what I could make from the samples it seems that it has been replaced by the ServiceBuilder implementation, is this correct? If so, will other features currently present on ServiceHost (Description.Behaviors etc.) be ported as well?

Regards,

Wouter

Guidance on running net core server and client

I copied down the zip file of src and was able to build with no problems.
I tried to run net core server and got an error
"The project does not know how to run the profile IIS Express"
I switched the net core server project from
Sdk="Microsoft.NET.Sdk"
to
Sdk="Microsoft.NET.Sdk.Web"
which got things started, but the browser came up for some reason with address
http://localhost:1438/
I didn't expect IIS was needed (is it) and is there some preliminary documentation to guide me through the process of running?
We are switching to .net core 3 and looking just to get our server compiling but not running until full release is available.

Code files simplification suggestion

hi guys,

After I cloned CoreWCF and opened the solution using Visual Studio, I see some linked files repeated everywhere:

image

Why are the projects organized like this? I know the magic is in the Directory.Build.targets file, but it is not quite easy to reason by directly looking at the csproj, because the linked files weren't there.

These "Common" files I think should be just included as part of CoreWCF.Primitives project, because it is used by both CoreWCF.Http and CoreWCF.NetTcp.

It is also easier for me to maintain. If my feedback is accepted, I'd like to submit PR to include those files in "Common" into CoreWCF.Primitives project.

cc @tibor19

Why is XmlSerializerFormatAttribute internal?

I have an existing WCF application that I have been looking to port to .NET Core for a while now. I am currently evaluating of this is feasible with this library, however the first thing I run into is the fact that XmlSerializerFormatAttribute is not supported?

The application I have needs to have this attribute in order to serialize the XML to conform to the existing standard. I already tried using the XmlSerializerFormatAttribute from System.ServiceModel.Primitives, but that does not work.
If I change the XmlSerializerFormatAttribute from internal to public (together with some enums to satisfy the compiler) it does exactly what I need, but I'm sure there is a reason why this attribute is not public.

One way async operations raising exception

I need to implement a pre-defined(from vendor) wsdl & xsd. They have defined the operation as "IsOneWay".

I generated the proxies using svcutil.exe using the wsdl & xsd.

If you look at the proxy, it generates it as follows:

[XmlSerializerFormat] [System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://callback.someCompany.com/some_callback/someMethod")] System.Threading.Tasks.Task someMethodAsync(t_data_event request);

When you try to start the service up, it raises the following exception:
System.ArgumentException: .NET type CancellationToken cannot be resolved into XML schema type
at SoapCore.MetaBodyWriter.ResolveType(Type type)
at SoapCore.MetaBodyWriter.AddSchemaType(XmlDictionaryWriter writer, Type type, String name, Boolean isArray, String namespace)
at SoapCore.MetaBodyWriter.AddTypes(XmlDictionaryWriter writer)
at SoapCore.MetaBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.Message.OnWriteBodyContentsAsync(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.Message.OnWriteMessageAsync(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.Message.WriteMessageAsync(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessageAsync(Message message, Stream stream)
at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessageAsyncInternal(Message message, Stream stream)
at System.Runtime.TaskHelpers.WaitForCompletionNoSpin(Task task)
at SoapCore.SoapEndpointMiddleware.ProcessMeta(HttpContext httpContext)
at SoapCore.SoapEndpointMiddleware.ProcessOperation(HttpContext httpContext, IServiceProvider serviceProvider)
at SoapCore.SoapEndpointMiddleware.Invoke(HttpContext httpContext, IServiceProvider serviceProvider)
at SoapCore.SoapEndpointMiddleware.Invoke(HttpContext httpContext, IServiceProvider serviceProvider)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

The problem seems to be that the OneWay async implementation is not supported. In the process of finding the problem I added a return object in the code():

[XmlSerializerFormat] [System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://callback.someCompany.com/some_callback/someMethod")] System.Threading.Tasks.Task<bool> someMethodAsync(t_data_event request);

It then starts up, however I cannot request the vendor to change due numerous other clients not having a problem with this implementation.

Your guidance will be appreciated.

Http and Tcp samples have different behavior

Problem

When running the provided sample projects, there is a difference in behavior between the service running over TCP and the service running over HTTP. The HTTP service is constructed on every call whereas the TCP instance is re-used after being constructed for the first time.

Steps to repro:

  1. Clone the following branch which has a minimal repro of the issue: https://github.com/Treit/CoreWCF/tree/dev/mtreit/HttpVsTcpRepro
  2. Run dotnet build from the src folder
  3. Run start dotnet ..\bin\NetCoreServer\netcoreapp2.2\NetCoreServer.dll
  4. Run start dotnet ..\bin\NetCoreClient\netcoreapp2.2\NetCoreClient.dll
  5. In the client window that opens, type some text and press enter. Repeat several times.

Expected Result:

The behavior of the TCP and HTTP versions of the service is the same.

Actual Result:

You will see that the behavior is different. The TCP version of the service increments it's member variable receivedCount on each call, whereas the value remains stuck forever at 1 for the HTTP version of the service.

Notes:

The difference in behavior is because the HTTP version of the service is re-constructed anew on each call, whereas with the TCP version the instance is re-used after the first call.

The output from the service if you send the string 'abc' to it twice is as follows:

EchoService constructed.
Received abc from client! Received so far: 1
EchoService constructed.
Received abc from client! Received so far: 1
Received abc from client! Received so far: 2
EchoService constructed.
Received abc from client! Received so far: 1

Debugging shows that the HTTP version is constructed anew on each call, as indicated by the 'EchoService constructed' output: on the first call both the TCP and HTTP instances were constructed (as expected) but after that the TCP instance was re-used and the HTTP instance was constructed again.

It's not clear if this is just an issue with how the sample services is coded or a more fundamental bug, but I would think that the transport protocol used in the samples should not cause such a difference in behavior (i.e., the HTTP instance is essentially stateless and the TCP instance is stateful.)

Mex endpoint?

How do I configure mex endpoint using builder.AddServiceEndpoint() method?

Support for HTTP.sys webserver

Is it possible to add support for the HTTP.sys webserver?
I have two reasons for using this webserver over the Kestrel web server:

  1. It adds support for Windows Authentication.
  2. Unlike Kestrel, I can bind this webserver to a port already in use by other legacy .NET components, just listening on other paths.

I have developed a PoC, but the moment I migrate from this:

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
            .UseKestrel(options => {
                options.ListenLocalhost(7002);
                options.AllowSynchronousIO = true;
            })
            .UseUrls("http://localhost:7002")
            .UseStartup<Startup>();

to

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder => {
                    webBuilder.UseHttpSys(options => {
                        options.AllowSynchronousIO = true;
                        options.UrlPrefixes.Add("http://localhost:7002/");
                        options.EnableResponseCaching = false;
                    });
                    webBuilder.UseStartup<Startup>();
                });

It breaks. I can still fetch the URL, but I get a 504:

failed: The server did not return a complete response for this request. The server returned 0 bytes.

Wil CoreWCF be able to encrypt across the wire

I don't know if its to early to ask this question, but will CoreWCF support encryption across the wire over tcp or will it support https using kestrel. I don't really care about what is be it JSON or so on. I just want to know will be able to add encryption so that things are not sent plain text over the wire.

Calling async WCF method timeout

here is my service:

    public class EchoService : Contract.IEchoService
    {
        public async Task<string> Echo(string text)
        {
            System.Console.WriteLine($"Received {text} from client!");
            await Task.Delay(1000);
            System.Console.WriteLine($"Received {text} from client 2!");
            return text;
        }
    }

and my client:

            var factory = new ChannelFactory<IEchoService>(new BasicHttpBinding(), new EndpointAddress("http://localhost:8080/basichttp"));
            factory.Open();
            var channel = factory.CreateChannel();
            ((IClientChannel)channel).Open();
            while (true)
            {
                Console.WriteLine("Echo(\"Hello\") => " + await channel.Echo("Hello"));
                Thread.Sleep(1000);

            }
            ((IClientChannel)channel).Close();
            factory.Close();

            Console.WriteLine("Hit enter to exit");
            Console.ReadLine();

on server in console:

Received Hello from client!
Received Hello from client 2!

on client in console:

Unhandled Exception: System.TimeoutException: The request channel timed out attempting to send after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The HTTP request to 'http://localhost:8080/basichttp' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.

This is working correctly in the previous version.
I downloaded the previous version on 13.10.2019 8:55

NamedPipes?

Are there any plans for NamedPipe support?

Add support for dynamic Javascript proxies

One nice thing about WCF is it has the ability to generate a Javascript proxy script, such as /MyService.svc/js. ASP.NET Core doesn't appear to have anything similar. Curious if CoreWCF already does (or will) provide this functionality as well. Thanks!

Add to FaultException a constructor that accepts the TDetail as its only arg

In our old service methods, we use FaultException like so:

throw new FaultException<Exception> ( ex );

However that does not exist in CoreWCF, but it does in System.ServiceModel so in our service implementations we have been using System.ServiceModel so we don't have to change all our
service methods. Is it possible to add to FaultException a constructor that accepts the TDetail as its only arg?

Build warnings related to un-used fields

Problem:
There are close to 50 warnings when you build Core WCF, mostly CS0067 (event 'x' is never used), CS0169 (field 'x' is never used) and CS0649 (field 'x' is never assigned to.)

Steps to repro:
Run dotnet build -t:rebuild from the src folder.

Expected Result:
The build is clean with no warnings.

Actual Result:
There are 47 build warnings.

Notes:
I have attached the full list of warnings.
corewcf_build_warnings.txt

Need mechanism to translate between FaultException<T> types

System.ServiceModel.FaultException<T> is .NET Standard compliant, so code from .NET Standard libraries that are hosted in CoreWCF may throw this FaultException type and assume it should result in the correct SOAP fault being returned to the caller.

CoreWCF defines it's own CoreWCF.FaultException<T> type, however, so .NET Standard code that should ideally work whether hosted in either CoreWCF or a traditional .NET Framework WCF service does not work as desired.

When porting a large existing service to CoreWCF, it is highly desirable to be able to share code between the existing service and the new one. The lack of a common FaultException<T> type makes this problematic.

We need a mechanism to somehow translate between the two FaultException<T> types, so code hosted in a CoreWCF process that throws a System.ServiceModel.FaultException<T> is able to successfully transmit the intended fault back to the caller.

Compatibility expectations for extensions

Hi,

I know this question gets asked a lot, but mostly people focuses on contracts.

In my spare time I'm working on adding support for AWS X-Ray to our Windows WCF services. https://github.com/Kralizek/xray-wcf/

Which level of compatibility am I to expect for the service behavior and the dispatch message inspector?

I am expecting the need of pointing to new packages and do some namespace update, but I'm hoping to keep the operational logic the same. Am I being too optimistic?

PS: Thank you for the great work you're putting into this project!

Latest CoreWCF not building, cannot find git directory

Sorry but I pulled down the latest code today using zip file download. Then I extract and build all and get the error "Can't find the .git directory". What am I doing wrong?

.nuget\packages\gitversiontask\5.1.2\build\GitVersionTask.targets(10,9): error : DirectoryNotFoundException: Can't find the .git directory in 1>.nuget\packages\gitversiontask\5.1.2\build\GitVersionTask.targets(10,9): error : at GitVersion.GitPreparer.GetDotGitDirectoryInternal() in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 73 1>.nuget\packages\gitversiontask\5.1.2\build\GitVersionTask.targets(10,9): error : at GitVersion.GitPreparer.GetDotGitDirectory() in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 25 1>.nuget\packages\gitversiontask\5.1.2\build\GitVersionTask.targets(10,9): error : at GitVersion.GitVersionCalculator.CalculateVersionVariables() in D:\a\1\s\src\GitVersionCore\GitVersionCalculator.cs:line 54 1>.nuget\packages\gitversiontask\5.1.2\build\GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTaskExecutor.WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task) in D:\a\1\s\src\GitVersionTask\GitVersionTaskExecutor.cs:line 65 1>.nuget\packages\gitversiontask\5.1.2\build\GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTasks.<>c__DisplayClass3_0.<WriteVersionInfoToBuildLog>b__0(IGitVersionTaskExecutor executor) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 20 1>.nuget\packages\gitversiontask\5.1.2\build\GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action1 action) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 31
1>.nuget\packages\gitversiontask\5.1.2\build\GitVersionTask.targets(10,9): error :
1>Done building project "CoreWCF.Primitives.csproj" -- FAILED.`

Plan for documentation

We need to start having some documentation so need to decide how this will look. Some of the decisions needing to be made are:

  • Where will the raw docs live
  • What tooling to use
  • Where will the published docs live

Some of these decisions are inter-related, for example having the documentation on readthedocs.io would be easiest using Sphinx or MkDocs for documentation generation (although it does support creating your own custom docs build system, I really don't want to maintain something too custom like that).

Raw documentation location
I see 3 potential options:

  1. In a docs folder at the root of the master branch of the CoreWCF/CoreWCF repo
  2. In a special docs branch in the CoreWCF/CoreWCF repo, similar to how github pages publish from a gh-pages branch
  3. In a separate repo in the CoreWCF org. E.g. CoreWCF/Docs

One thing to consider is that the documentation will eventually be quite substantial in size. It's because of this that I didn't list the option of inline documentation in the code. I believe CoreWCF documentation would be too large to place inline.

Tooling
I had a quick look around and these are the options I've come across. Feel free to add any more I may have missed.

  1. Sphinx (link)
  2. MkDocs (link)
  3. DocFX (https://dotnet.github.io/docfx/)

For completion, I'll mention there are in-line code comment based documentation tools such as doxygen. As I already mentioned, because the WCF documentation tends to be very large, I don't think it's appropriate to place this inline with the code.

Published documentation location
I see there being a few options.

  1. https://corewcf.readthedocs.io/ as is currently listed in the contributing guide.
  2. Github pages
  3. A potential future site hosted by dotnetfoundation as suggested in dotnet-foundation/projects#21

First release

Hi,

When is the first release planned for CoreWCF?

Thanks!

What need to know if use CoreWCF with reverse proxy?

I have some problem when use traefik with CoreWCF. I also try to use traefik with ASP.NET Core and it works fine. They work parallel. ASP.NET Core works. CoreWCF doesn't work.

I already looked at issue in traefik repo (traefik/traefik#3237). But configuring traefik doesn't help.

I've got next logs on traefik side:
traefik_reverse-proxy.1.x9n3o282ax36@dm-node1 | time="2020-02-12T11:39:35Z" level=debug msg="'502 Bad Gateway' caused by: EOF"

The application says:

cloud-service_transport.1.vfgenw539lcb@dm-node2    | info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
cloud-service_transport.1.vfgenw539lcb@dm-node2    |       Request starting HTTP/1.1 POST http://transport.local/Transport/StroySoft.SmetaCloud.Transport.TransportContract.svc text/xml 190
cloud-service_transport.1.vfgenw539lcb@dm-node2    |
cloud-service_transport.1.vfgenw539lcb@dm-node2    | ===== START REQUEST HEADERS =====
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Cache-Control: no-cache
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Content-Type: text/xml
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Accept: */*
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Accept-Encoding: gzip, deflate, br
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Host: transport.local
cloud-service_transport.1.vfgenw539lcb@dm-node2    | User-Agent: PostmanRuntime/7.22.0
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Content-Length: 190
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Postman-Token: 34793746-406c-4e89-bb4a-e5236644df20
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Soapaction: stroysoft:smetacloud:transport/ITransportContract/Echo
cloud-service_transport.1.vfgenw539lcb@dm-node2    | X-Forwarded-For: 10.0.0.2
cloud-service_transport.1.vfgenw539lcb@dm-node2    | X-Forwarded-Host: transport.local
cloud-service_transport.1.vfgenw539lcb@dm-node2    | X-Forwarded-Port: 80
cloud-service_transport.1.vfgenw539lcb@dm-node2    | X-Forwarded-Proto: http
cloud-service_transport.1.vfgenw539lcb@dm-node2    | X-Forwarded-Server: d7d5651d5acb
cloud-service_transport.1.vfgenw539lcb@dm-node2    | X-Real-Ip: 10.0.0.2
cloud-service_transport.1.vfgenw539lcb@dm-node2    | ===== END REQUEST HEADERS =====
cloud-service_transport.1.vfgenw539lcb@dm-node2    |
cloud-service_transport.1.vfgenw539lcb@dm-node2    | ===== START REQUEST BODY =====
cloud-service_transport.1.vfgenw539lcb@dm-node2    | <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
cloud-service_transport.1.vfgenw539lcb@dm-node2    |  <soapenv:Body>
cloud-service_transport.1.vfgenw539lcb@dm-node2    |  <Echo xmlns="stroysoft:smetacloud:transport">
cloud-service_transport.1.vfgenw539lcb@dm-node2    |  </Echo>
cloud-service_transport.1.vfgenw539lcb@dm-node2    |  </soapenv:Body>
cloud-service_transport.1.vfgenw539lcb@dm-node2    | </soapenv:Envelope>
cloud-service_transport.1.vfgenw539lcb@dm-node2    | ===== END REQUEST BODY =====
cloud-service_transport.1.vfgenw539lcb@dm-node2    |
cloud-service_transport.1.vfgenw539lcb@dm-node2    | info: Microsoft.AspNetCore.Server.Kestrel[34]
cloud-service_transport.1.vfgenw539lcb@dm-node2    |       Connection id "0HLTFMGVONIE6", Request id "0HLTFMGVONIE6:00000001": the application aborted the connection.
cloud-service_transport.1.vfgenw539lcb@dm-node2    | info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
cloud-service_transport.1.vfgenw539lcb@dm-node2    |       Request finished in 327.7999ms 0
cloud-service_transport.1.vfgenw539lcb@dm-node2    | warn: Microsoft.AspNetCore.Server.Kestrel[0]
cloud-service_transport.1.vfgenw539lcb@dm-node2    |       Connection processing ended abnormally.
cloud-service_transport.1.vfgenw539lcb@dm-node2    | Microsoft.AspNetCore.Connections.ConnectionAbortedException: The connection was aborted by the application.
cloud-service_transport.1.vfgenw539lcb@dm-node2    |    at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
cloud-service_transport.1.vfgenw539lcb@dm-node2    |    at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
cloud-service_transport.1.vfgenw539lcb@dm-node2    |    at System.IO.Pipelines.Pipe.ReadAsync(CancellationToken token)
cloud-service_transport.1.vfgenw539lcb@dm-node2    |    at System.IO.Pipelines.Pipe.DefaultPipeReader.ReadAsync(CancellationToken cancellationToken)
cloud-service_transport.1.vfgenw539lcb@dm-node2    |    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.BeginRead(ValueTask`1& awaitable)
cloud-service_transport.1.vfgenw539lcb@dm-node2    |    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
cloud-service_transport.1.vfgenw539lcb@dm-node2    |    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)

Some logs have writen by my middleware which I add when try to debug it.
Direct requests without reverse-proxy finishes normally and I get a response with status 200:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <EchoResponse xmlns="stroysoft:smetacloud:transport">
            <EchoResult>Echo transport: </EchoResult>
        </EchoResponse>
    </s:Body>
</s:Envelope>

With reverse proxy I get a response with status 502:
Bad Gateway

If need more information only say and I'll try to get it for you.

ServiceContract and OperationContract namespace

Hi and thanks for this project!
Since .NET Core already has support for System.ServiceModel.Primitives (which can be used for the client), I was wondering why (and if) it was necessary to have CoreWCF.ServiceContract (and CoreWCF.OperationContract)?
Couldn't System.ServiceModel.ServiceContract be used and save the need to update the namespace for the services or have both ServiceContract attributes (for a shared library)?

CoreWcf nuget package transition

Tasks

  1. Let me know who the owners need to be and we can start the transition.
  2. Would be nice to have a footnote on the readme of this repo that mentions and links back to my repo just so that if someone did get confused and lost they'd know where to go.
    2.1 I'll do same from my old repo to this one.
  3. De-list the existing versions once the first release from here is made?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.