Closed liugt34 closed 7 years ago
My Dockerfile
FROM microsoft/aspnetcore:1.1.2 WORKDIR /app EXPOSE 80 COPY . . ENTRYPOINT ["dotnet", "Spring.Web.dll"]
then i use the command $ docker build -t springapp . $ docker run -d -p 8000:80 springapp
the container's status is Exited(139) 20s ago
@liugt34 can you share enough code to reproduce this bug? It does not appear to be related to Docker specifically, but it is hard to tell without a way to reproduce your error.
@natemcmaster thank you for reply, but it worked well on windows it is the program.cs `
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.Build();
var host = new WebHostBuilder()
.UseKestrel()
.UseConfiguration(config)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
//.UseUrls("http://*:8080")
.UseApplicationInsights()
.Build();
host.Run();
`
it is the Startup.cs `
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
when i comment the AddJsonFile(xxx) method , it can run on linux
appsettings.json
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
},
"Admin": {
"UserName": "008759,008758",
"Password": "123456,12345456789"
},
"Data": "LineZero",
"ConnectionStrings": {
"DefaultConnection": "Server=10.xxx.xxx.xx0;Port=3xx8;DataBase=czygw_db;uid=springweb;password=11111;SslMode=None"
}
}
when i comment the AddJsonFile(xxx) method , it can run on linux
Which AddJsonFile call? Or do you have to remove both?
(1) > .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) (2) > .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
I am assuming it's only (1). The stack trace shows that the error came from instantiating the file watcher. I'm guessing this means that there is a directory in your project that has illegal characters in the file or directory name. By default, the file watcher scans all subdirectories (see https://github.com/aspnet/FileSystem/blob/rel/1.1.1/src/Microsoft.Extensions.FileProviders.Physical/PhysicalFilesWatcher.cs#L52). This would explain the stack trace:
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance..ctor(FileSystemWatcher watcher, SafeFileHandle inotifyHandle, String directoryPath, Boolean includeSubdir ectories, NotifyEvents notifyFilters, CancellationToken cancellationToken)
at System.IO.FileSystemWatcher.StartRaisingEvents()
Try setting reloadOnChange: false
to workaround it.
@natemcmaster thank you very much , i found the problem some images in wwwroot has name with chinese word, so linux can't resolve it this issue cost me more than 3 days, thank u again
CentOS7.0 .NET CORE 1.1.2 I have met this problem, i did'not find anyway to solve it , i have no idea about it