【问题标题】:Configuring Full framework assemblies called by Asp.Net Core 2.0 App?配置由 Asp.Net Core 2.0 App 调用的完整框架程序集?
【发布时间】:2017-11-06 20:42:34
【问题描述】:

我正在开发 ASP.NET Core 网站。我的网站有一个完整框架程序集的参考,该程序集使用来自老式 web.config 文件的配置应用程序设置,无法控制此程序集,代码无法修复和重新编译

配置文件看起来像

<appSettings>
  <add key="marketDataServiceEndpointName" value="UatMarketDataService"/>
</appSettings>
<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="DebugBinding"/>
  </basicHttpBinding>
  <netTcpBinding>
    <binding name="ServiceNetTcp" 
             maxBufferPoolSize="2147483647" 
             maxReceivedMessageSize="2147483647" 
              sendTimeout="10:00:00" 
             closeTimeout="10:00:00" openTimeout="10:00:00" 
             receiveTimeout="10:00:00">
      <security mode="None"/>
    </binding>

    <binding name="loggingService" sendTimeout="00:05:00">
      <security mode="None"/>
    </binding>
  </netTcpBinding>
</bindings>
<client>
  <endpoint 
     address="net.tcp://localhost/Service/Service.svc" 
     binding="netTcpBinding" bindingConfiguration="loggingService" 
     contract="ServiceContracts.IService" name="IVisionLoggingService"/>
  <endpoint 
  address="http://localhost:62698/Service.svc" 
  binding="basicHttpBinding" 
  bindingConfiguration="DebugBinding" 
   contract="Service.IService" name="DebugBinding"/>
</client>

我尝试为程序集提供一个配置文件,例如 带有所有配置参数的“MyAssemblyName.dll.config”。 不幸的是,它似乎没有读取配置文件

【问题讨论】:

  • 我不认为你可以使用它。 wcf 不是 .net 标准的一部分。

标签: c# wcf .net-core .net-assembly appsettings


【解决方案1】:

.NET Core 没有基于 .config 文件的 .NET Framework 的配置系统,因此不会被尊重。如果没有额外的支持库,对System.Configuration 类型的调用甚至会在运行时失败。围绕Microsoft.Extensions.Configuration 和相关的NuGet 包构建了一个new configuration system。 (甚至可以在 .NET Core / ASP.NET Core 之外使用)

另请注意,.NET Core 2.0 没有任何服务器端 WCF 服务托管功能,因此即使通过其他配置系统,您尝试完成的工作也无法工作。

【讨论】:

  • .net 核心上的 asp.net 核心:仅支持一个子集。不是 wcf。为此,您仍然可以在 .net 框架上使用 asp.net 核心。
猜你喜欢
  • 2019-08-19
  • 1970-01-01
  • 1970-01-01
  • 2018-10-19
  • 1970-01-01
  • 2016-09-20
  • 1970-01-01
  • 2018-08-16
  • 1970-01-01
相关资源
最近更新 更多