Skip to content

Commit

Permalink
814:修复:V5.9.0.3优化的内部IP获取,在Docker容器不支持的异常。 【V5.9.0.5】
Browse files Browse the repository at this point in the history
  • Loading branch information
cyq1162 committed Jan 21, 2024
1 parent fb507e2 commit 889404d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 15 deletions.
3 changes: 2 additions & 1 deletion UpdateLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1071,4 +1071,5 @@
811���Ż����ڲ�IP��ȡ��
-------------------------------------------------------------------------------------
812���޸���AppConfig.IsDebugMode .net ��ȡֵ����2024-01-21����V5.9.0.4��
813���������ֲ�ʽ�������ݵ��Է�������2024-01-21��
813���������ֲ�ʽ�������ݵ��Է�������2024-01-21��
814���޸���V5.9.0.3�Ż����ڲ�IP��ȡ����Docker������֧�ֵ��쳣�� ��V5.9.0.5��
2 changes: 1 addition & 1 deletion src/CYQ.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RootNamespace>CYQ.Data</RootNamespace>
<AssemblyName>CYQ.Data</AssemblyName>
<SignAssembly>false</SignAssembly>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
Expand Down
6 changes: 3 additions & 3 deletions src/CYQ.Data_NetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>CYQ.Data</AssemblyName>
<RootNamespace>CYQ.Data</RootNamespace>
<Authors>路过秋天</Authors>
Expand All @@ -12,8 +12,8 @@
<PackageProjectUrl>https://github.com/cyq1162/cyqdata</PackageProjectUrl>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<AssemblyTitle>CYQ.Data 数据层(ORM)框架 V5 .NET Core 版本</AssemblyTitle>
<AssemblyVersion>5.9.0.4</AssemblyVersion>
<FileVersion>5.9.0.4</FileVersion>
<AssemblyVersion>5.9.0.5</AssemblyVersion>
<FileVersion>5.9.0.5</FileVersion>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/CYQ.Data_Standard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<BaseOutputPath>bin\Standard\</BaseOutputPath>
<BaseIntermediateOutputPath>obj\Standard\</BaseIntermediateOutputPath>
<BaseOutputPath></BaseOutputPath>
<BaseIntermediateOutputPath></BaseIntermediateOutputPath>
<AssemblyName>CYQ.Data</AssemblyName>
<RootNamespace>CYQ.Data</RootNamespace>
<Authors>路过秋天</Authors>
<Description>cyq.data is a high-performance and the most powerful orm.(.Net 最好用的ORM数据层框架,木有之一,低调持续更新15年!支持.Net Framework 2.0+,支持.Net Core 2.1+,自带数据库读写分离,分布式缓存,分布式锁等)Support:Txt、Xml、Access、Sqlite、Mssql、Mysql、Oracle、Sybase、Postgres、DB2、Redis、MemCache。【开源:https://github.com/cyq1162/cyqdata】</Description>
<Product>CYQ.Data 数据层(ORM)框架 V5 .NET Standard 版本</Product>
<Company>路过秋天 (2024-01-13)</Company>
<Company>路过秋天 (2024-01-21)</Company>
<Copyright>版权所有 (C) 路过秋天 2010-2030</Copyright>
<PackageProjectUrl>https://github.com/cyq1162/cyqdata</PackageProjectUrl>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<AssemblyTitle>CYQ.Data 数据层(ORM)框架 V5 .NET Standard 版本</AssemblyTitle>
<AssemblyVersion>5.9.0.3</AssemblyVersion>
<FileVersion>5.9.0.3</FileVersion>
<AssemblyVersion>5.9.0.5</AssemblyVersion>
<FileVersion>5.9.0.5</FileVersion>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
Expand Down
21 changes: 19 additions & 2 deletions src/Log/LocalEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,31 @@ public static string HostIP
{
if (string.IsNullOrEmpty(_HostIP))
{
bool isSupportDADS = true;
var nets = NetworkInterface.GetAllNetworkInterfaces();
foreach (var item in nets)
{
var ips = item.GetIPProperties().UnicastAddresses;
foreach (var ip in ips)
{
if (ip.Address.AddressFamily == AddressFamily.InterNetwork && !IPAddress.IsLoopback(ip.Address) && ip.DuplicateAddressDetectionState == DuplicateAddressDetectionState.Preferred)
if (ip.Address.AddressFamily == AddressFamily.InterNetwork && !IPAddress.IsLoopback(ip.Address))
{
try
{
if (isSupportDADS)
{
if (ip.DuplicateAddressDetectionState != DuplicateAddressDetectionState.Preferred)
{
continue;
}

}
}
catch (PlatformNotSupportedException err)
{
isSupportDADS = false;
}

string ipAddr = ip.Address.ToString();
if (ipAddr.EndsWith(".1") || ipAddr.Contains(":")) // 忽略路由和网卡地址。
{
Expand All @@ -83,7 +100,7 @@ public static string HostIP
}
}
}
return _HostIP ?? HostName;
return _HostIP ?? "127.0.0.1";
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[assembly: AssemblyTitle("CYQ.Data 数据层(ORM)框架 V5 版本")]
[assembly: AssemblyDescription("cyq.data is a high-performance and the most powerful orm.(.Net 最好用的ORM数据层框架,木有之一,低调持续更新15年!支持.Net Framework 2.0+,支持.Net Core 2.1+,自带数据库读写分离,分布式缓存,分布式锁等)Support:Txt、Xml、Access、Sqlite、Mssql、Mysql、Oracle、Sybase、Postgres、DB2、Redis、MemCache。【开源:https://github.com/cyq1162/cyqdata】")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("路过秋天 (2024-01-13)")]
[assembly: AssemblyCompany("路过秋天 (2024-01-21)")]
[assembly: AssemblyProduct("CYQ.Data 数据层(ORM)框架 V5 版本")]
[assembly: AssemblyCopyright("版权所有 (C) 路过秋天 2010-2110")]
[assembly: AssemblyTrademark("CYQ.Data")]
Expand All @@ -31,5 +31,5 @@
//
// 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值,
// 方法是按如下所示使用“*”:
[assembly: AssemblyVersion("5.9.0.3")]
[assembly: AssemblyFileVersion("5.9.0.3")]
[assembly: AssemblyVersion("5.9.0.5")]
[assembly: AssemblyFileVersion("5.9.0.5")]

0 comments on commit 889404d

Please sign in to comment.