Unhandled Exception: System.InvalidOperationException: Failed to create instance of type 'Com.Ctrip.Framework.Apollo.ApolloOptions'. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Com.Ctrip.Framework.Apollo.Foundation.NetworkInterfaceManager' threw an exception. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: No such device or address
at System.Net.Dns.InternalGetHostByName(String hostName)
at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
at Com.Ctrip.Framework.Apollo.Foundation.NetworkInterfaceManager.Refresh()
at Com.Ctrip.Framework.Apollo.Foundation.NetworkInterfaceManager..cctor()
--- End of inner exception stack trace ---
at Com.Ctrip.Framework.Apollo.Foundation.NetworkInterfaceManager.get_HostIp()
at Com.Ctrip.Framework.Apollo.ApolloOptions..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
at Microsoft.Extensions.Configuration.ConfigurationBinder.CreateInstance(Type type)
--- End of inner exception stack trace ---
at Microsoft.Extensions.Configuration.ConfigurationBinder.CreateInstance(Type type)
at Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config, BinderOptions options)
at Microsoft.Extensions.Configuration.ConfigurationBinder.Get(IConfiguration configuration, Type type, Action`1 configureOptions)
at Microsoft.Extensions.Configuration.ConfigurationBinder.Get[T](IConfiguration configuration, Action`1 configureOptions)
at Microsoft.Extensions.Configuration.ConfigurationBinder.Get[T](IConfiguration configuration)
at FabricDemo.UserService.Program.<>c.<CreateWebHostBuilder>b__1_0(WebHostBuilderContext hostingContext, IConfigurationBuilder builder) in /src/src/FabricDemo.UserService/Program.cs:line 25
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at FabricDemo.UserService.Program.Main(String[] args) in /src/src/FabricDemo.UserService/Program.cs:line 15
/// <inheritdoc />
public class Program
{
/// <inheritdoc />
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
/// <inheritdoc />
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration(
(hostingContext, builder) =>
{
builder.AddApollo(builder.Build().GetSection("apollo"))
.AddDefault()
.AddNamespace("TEST1.ConsulPublic");
})
.UseStartup<Startup>();
}
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 54045
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY src/FabricDemo.UserService/FabricDemo.UserService.csproj src/FabricDemo.UserService/
RUN dotnet restore src/FabricDemo.UserService/FabricDemo.UserService.csproj
COPY . .
WORKDIR /src/src/FabricDemo.UserService
RUN dotnet build FabricDemo.UserService.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish FabricDemo.UserService.csproj -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "FabricDemo.UserService.dll"]
version: '3'
services:
userservice:
container_name: userservice
image: fabricdemo/userservice:${TAG:-latest}
build:
context: .
dockerfile: src/FabricDemo.UserService/Dockerfile
network_mode: host
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://127.0.0.1:54045
ports:
- "54045:54045"