最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asp.net core - MissingMethodException within Umbraco - Stack Overflow

programmeradmin2浏览0评论

I have an Umbraco (v13.5.2) project (call it project A) which is running fine in ASP.NET Core (.NET 8.0). I have a second project (call it project B) for the controllers which also references the same Umbraco version. The Umbraco packages have been add using the Visual Studio's NuGet Manager and I can see all the common packages between the two projects are the same.

Project A runs fines and does exactly what you'd expect. Project B compiles without issue and can be used, for instance from a console application. But, if I add a project reference in project A to project B, project A fails to run correctly. I get a blank browser page and the only error is in the logs:

{"@t":"2025-01-20T19:02:25.1073019Z",
 "@mt":"Unexpected exception in static IISHttpServer.HandleRequest.",
 "@l":"Error",
 "@x":"System.MissingMethodException: Method not found: 'System.Nullable`1<System.Net.Security.TlsCipherSuite> Microsoft.AspNetCore.Connections.Features.ITlsHandshakeFeature.get_NegotiatedCipherSuite()'.
    at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.IISContextFactory`1.CreateHttpContext
    at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.HandleRequest(IntPtr pInProcessHandler, IntPtr pvRequestContext)",
    "SourceContext":"Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer",
    "ProcessId":45108,
    "ProcessName":"iisexpress",
    "ThreadId":21,
    "ApplicationId":***
    "MachineName":***,
 "Log4NetLevel":"ERROR"}

Whilst searching the web provides various suggestions none of the seem to resolve this issue for me. Some suggest that I need to upgrade the Microsoft.AspNetCore.Connections.Abstractions package to the latest version (which is 9.0.1) it is a transitive package currently on 9.0.0 (the slightly newer version was published on the 14th, I had this issue before then i.e. when I was on the latest version). Others suggest it is a versioning issue but all my packages are on the same versions across projects.

Upgrading to Umbraco v15 or .NET9 isn't an option as I'm required to stay on the most recent LTS versions.

I'm at a bit of a loss as to how to fix this. (I thought I had at one point but it was just that I'd removed the reference to project B from project A).

EDIT As request the project files are below.

'Project B'

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <OutputType>Library</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Umbraco.Cms.Core" Version="13.5.2" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Entities\Entities.csproj" />
  </ItemGroup>

</Project>

'Project A'

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <RootNamespace>My.Umbraco</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Umbraco.Cms" Version="13.5.2" />
  </ItemGroup>

  <ItemGroup>
    <!-- Opt-in to app-local ICU to ensure consistent globalization APIs across different platforms -->
    <PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
    <ProjectReference Include="..\Controllers\Controllers.csproj" />
    <RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="72.1.0.3" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
  </ItemGroup>

  <PropertyGroup>
    <!-- Razor files are needed for the backoffice to work correctly -->
    <CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
  </PropertyGroup>

  <PropertyGroup>
    <!-- Remove RazorCompileOnBuild and RazorCompileOnPublish when not using ModelsMode InMemoryAuto -->
    <RazorCompileOnBuild>false</RazorCompileOnBuild>
    <RazorCompileOnPublish>false</RazorCompileOnPublish>
  </PropertyGroup>

</Project>

I have an Umbraco (v13.5.2) project (call it project A) which is running fine in ASP.NET Core (.NET 8.0). I have a second project (call it project B) for the controllers which also references the same Umbraco version. The Umbraco packages have been add using the Visual Studio's NuGet Manager and I can see all the common packages between the two projects are the same.

Project A runs fines and does exactly what you'd expect. Project B compiles without issue and can be used, for instance from a console application. But, if I add a project reference in project A to project B, project A fails to run correctly. I get a blank browser page and the only error is in the logs:

{"@t":"2025-01-20T19:02:25.1073019Z",
 "@mt":"Unexpected exception in static IISHttpServer.HandleRequest.",
 "@l":"Error",
 "@x":"System.MissingMethodException: Method not found: 'System.Nullable`1<System.Net.Security.TlsCipherSuite> Microsoft.AspNetCore.Connections.Features.ITlsHandshakeFeature.get_NegotiatedCipherSuite()'.
    at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.IISContextFactory`1.CreateHttpContext
    at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.HandleRequest(IntPtr pInProcessHandler, IntPtr pvRequestContext)",
    "SourceContext":"Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer",
    "ProcessId":45108,
    "ProcessName":"iisexpress",
    "ThreadId":21,
    "ApplicationId":***
    "MachineName":***,
 "Log4NetLevel":"ERROR"}

Whilst searching the web provides various suggestions none of the seem to resolve this issue for me. Some suggest that I need to upgrade the Microsoft.AspNetCore.Connections.Abstractions package to the latest version (which is 9.0.1) it is a transitive package currently on 9.0.0 (the slightly newer version was published on the 14th, I had this issue before then i.e. when I was on the latest version). Others suggest it is a versioning issue but all my packages are on the same versions across projects.

Upgrading to Umbraco v15 or .NET9 isn't an option as I'm required to stay on the most recent LTS versions.

I'm at a bit of a loss as to how to fix this. (I thought I had at one point but it was just that I'd removed the reference to project B from project A).

EDIT As request the project files are below.

'Project B'

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <OutputType>Library</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Umbraco.Cms.Core" Version="13.5.2" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Entities\Entities.csproj" />
  </ItemGroup>

</Project>

'Project A'

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <RootNamespace>My.Umbraco</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Umbraco.Cms" Version="13.5.2" />
  </ItemGroup>

  <ItemGroup>
    <!-- Opt-in to app-local ICU to ensure consistent globalization APIs across different platforms -->
    <PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
    <ProjectReference Include="..\Controllers\Controllers.csproj" />
    <RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="72.1.0.3" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
  </ItemGroup>

  <PropertyGroup>
    <!-- Razor files are needed for the backoffice to work correctly -->
    <CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
  </PropertyGroup>

  <PropertyGroup>
    <!-- Remove RazorCompileOnBuild and RazorCompileOnPublish when not using ModelsMode InMemoryAuto -->
    <RazorCompileOnBuild>false</RazorCompileOnBuild>
    <RazorCompileOnPublish>false</RazorCompileOnPublish>
  </PropertyGroup>

</Project>
Share Improve this question edited Jan 21 at 19:31 Rafael 2,0092 gold badges25 silver badges62 bronze badges asked Jan 20 at 19:39 B_DB_D 2352 silver badges18 bronze badges 2
  • Can you please share your csproj files? – Guru Stron Commented Jan 20 at 20:10
  • @GuruStron Added the project files as requested – B_D Commented Jan 21 at 10:32
Add a comment  | 

1 Answer 1

Reset to default 0

This turned out to be nothing to do wiht project B. There was a project C which both B referenced. It was originally a .NET Framework 4.7.2 project and was upgraded to .NET8 using Visual Studio upgrade tool.

Creating a new .NET8 library project and moving the files in along with updating for any required .NET changes resolved the issue.

发布评论

评论列表(0)

  1. 暂无评论