Wcf: Reopen #2295 - Message Header not scaffolded via Connected Service (not enabled for net45x)

Created on 14 Feb 2018  路  11Comments  路  Source: dotnet/wcf

Please reopen #2295 - this issue is not resolved. See latest comments on that item.

Simply put - in a current ASP.Net App using VS 2017 and current tooling by adding "Connected Service" when you scaffold this service: https://pe-96.praceng.us/reports/perepgen.asmx - You should get an attribute like this scaffolded:

c# [System.ServiceModel.MessageHeaderAttribute(Namespace = "http://www.praceng.com/webservices/perepgen")] public RepGen96.AuthenticationInformation AuthenticationInformation;

however you don't.

bug tooling

All 11 comments

@rposener, is your app targeting netcoreapp2.0? The message header is only supported after 2.0.

It's targeting .net framework 4.5.1 - what happened to that support?

@rposener the WCF connected services tool is for .net core projects. If your project targets for the full framework, you can use the "add service reference" tool just like before.

@zhenlan - I suppose I was a bit confused then. That is not an option in my project in VS 2017. I only have Add Connected Service as an option. Here is what my .csproj has:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
    <TypeScriptToolsVersion>2.5</TypeScriptToolsVersion>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>net452</TargetFramework>
    <RuntimeIdentifier>win7-x86</RuntimeIdentifier>
  </PropertyGroup>
...

I realize now I have not updated my Microsoft.AspNetCore nuget package (it is still 1.1.2). Are you suggesting that once I update that, my net452 project will support the Connected Service and Header Attribute properly?

We have logic in the connected service tool to create different code based on the availability of features in different versions of frameworks. Right now, the message header feature is injected when a project targets netcoreapp2.0, netstandard2.0 or later (this is fixed as part of #2295). @mlacouture, I think we should include net45x or later here too.

@rposener as a workarond, is it possible for you to change your target framework to netcoreapp2.0 temporarily and get proxy code generated? Then you can change the target framework back.

OK - now that I understand the goal (get my target framework to netcoreapp2.0) I better understand what I need to aim for. Will try to get my app upgraded to that framework if possible. If that proves problematic, will try your work-around to temporarily target it, scaffold, then set back to a full framework target (net461 seems like minimum if I update the AspNetCore packages as well). Will report back once I get this sorted - so the issue will be documented for any others that encounter the same.

Yes, this should work for net45x, I will use this issue to track a fix for it. thanks,

Thanks guys - finally got my project updated to target netcoreapp2.0 and can verify that did fix it. The newly scaffold-ed service is correct. I am running into a different question that I'm hoping one of you can easily/quickly answer.

In my creation of the SoapClient I need to pass in custom binding and address (from config for tenant elsewhere in my app). With the new target, it seems that EndpointAddress and BasicHttpBinding are not available? I can add a reference to the framework-specific DLL, but would much rather use a nuget package that keeps to the netstandard, and possibly opens me to running cross platform.

I have the System.ServiceModel.Http nuget package installed (I assume that added by the tool) - however, the reference is still unavailable. Any tips/ideas or is this just a known situation?

@rposener, glad you made it work.

Types like EndpointAddress and BasicHttpBinding ARE available on .NET Core. Please make sure you do package restore before using them.

Let's keep this thread for the original issue. Please open new issues for anything new.

We have a fix for this issue and we are planning to make it available with the release of VS 2017 v15.7 Preview 2.

VS 2017 v15.7 Preview 2 is now available.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevinoid picture kevinoid  路  6Comments

Petermarcu picture Petermarcu  路  4Comments

DotNetPart picture DotNetPart  路  6Comments

cristicatalan picture cristicatalan  路  4Comments

apdirexyon picture apdirexyon  路  5Comments