-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in .Net Core 3 preview 6 with individual user accounts in Linux docker #11609
Comments
From @livarcocc on Wednesday, June 26, 2019 5:10:25 PM @anurse another one that belongs in asp.net? |
I can repro this as described. Looks like an error in the StaticWebAssets.Reader:
The manifest file appears to have a Windows path: <StaticWebAssets Version="1.0">
<ContentRoot BasePath="_content/microsoftaspnetcoreidentityui" Path="C:\Users\anurse\.nuget\packages\microsoft.aspnetcore.identity.ui\3.0.0-preview6.19307.2\build\..\staticwebassets\" />
</StaticWebAssets> The docker tooling does a local build (on Windows) and then projects the application in to the (Linux) container via a volume mount so a Windows path is invalid here. @javiercn sounds like this is the stuff you added recently? (cc @mkArtakMSFT) |
@anurse Yes. I didn't think of docker scenarios, and this might be a headache. @SteveSandersonMS @danroth27 we should fix this. |
This is problematic because due to the way it works some things would have to happen:
|
Why are we burning in absolute paths here? Is this a dev-only experience? |
@anurse Yes |
We can use |
Hmm, I think we need to investigate this more. AFAIK the docker file will do a publish step
and run the app like
There should be no manifest involved in that. It might be that the way the docker tools run has changed and we might need to adapt the manifest. |
Right, but if you F5 directly, you can see in the output window that the commands it uses are to build the |
@anurse I see. Then I think we might need to do something for this case. That won't work even for referenced projects. |
If you just need to resolve the path to a NuGet package at dev-time, it might be better to leave out the absolute path and use something like the |
@anurse Can you try something quick for me given that you have this setup already? Could you setup Ultimately we have a manifest that I think has the wrong paths because it gets generated on windows and used on Linux, so a proper fix to this is gonna involve mounting additional volumes and overriding this manifest. |
Yeah, the docker tools do the "right thing" here, and you can even access this data at runtime via So, if you are just trying to resolve content relative to a specific NuGet package, rather than burning in the full path, you can burn in the ID, Version and Relative path: <StaticWebAssets Version="1.0">
<ContentRoot BasePath="_content/microsoftaspnetcoreidentityui" PackageId="Microsoft.AspNetCore.Identity.UI" Version="3.0.0-preview6.19307.2" Path="staticwebassets" />
</StaticWebAssets> Then at runtime you can take {
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\anurse\\.nuget\\packages",
"C:\\Microsoft\\Xamarin\\NuGet",
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
]
}
} The docker tools do take care of projecting each of these paths into the container via a volume mount. They also execute the app by providing the host with these new, container-local, paths as probing paths:
So when you query
|
Once you have those paths, you can probe by simply splitting on
I don't have the project handy to try that now. If that forces the entire build to happen in Docker, I expect it would fix the issue. It seems significantly limiting though. |
@anurse What you are suggesting is not an option as files on the package are defined through msbuild props files within the package, and not by some convention, and that also doesn't take into account referenced project with static assets. We also don't want to be bundling that resolution logic at the runtime level. I already started a thread about this with the appropriate people, I think making it go through the regular path is good enough for now if it worksaround it, while we work on a more complete fix. I think ultimately we will produce a list of paths that need to be mapped and have docker consume it, and we will produce an additional manifest that can be used with docker during development. |
I have the same issue, is there any workaround available? |
@endeffects try setting |
Thanks for your reply. But this does not fix the issue. |
When i run docker compose from console i'm getting the following error, The wwwroot of the client cannot be found:
Within Visual Studio i receive an other error by running the composer project:
|
I am having the same issue with a bare-bones
The resulting error is,
If I add the following line as the second-to-last-line in the Dockerfile then it works:
But this seems really bad. Does my production container really need all my nuget dependency packages? |
You don’t. This is a bug we are working on solving |
I don't believe we directly control the |
I've confirmed that with an updated docker file (see below) FROM mcr.microsoft.com/dotnet/core/aspnet:3.0.0-preview7-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["mvcpreview7docker.csproj", ""]
RUN dotnet restore "./mvcpreview7docker.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "mvcpreview7docker.csproj" -c Release -o /app
FROM build AS publish
# Put the publish content into its own folder
RUN dotnet publish "mvcpreview7docker.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
# Copy only the published content
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "mvcpreview7docker.dll"] |
@danroth27 @mkArtakMSFT I consider my work here done until we decide if we need to do a fix on our side to enable fast mode (or is something that the docker tooling takes care of) or if the current guidance to turn on regular mode is good enough. @danroth27 is gonna get in touch with the right folks to discuss what can be done here. Should we close this issue and open a new one to track that? |
@javiercn I still can't get it to work, i have provided a sample here: The sample uses a docker-compose project and a client side blazor application hosted on a .net core server. It also contains the third party library (BlazorStrap) that includes some static assets. I had the following issues with your last suggestion:
|
@endeffects On your dockerfile for the server you are setting the publish output to the same folder as the build output which is wrong and the root cause of the https://github.com/endeffects/DockerTest/blob/master/DockerTest.Server/Dockerfile#L16-L19 |
Yes, i also tried this as described above. |
What error are you seeing. |
|
You mean
|
@mkArtakMSFT We worked with the docker folks and the right changes have been made or are being made, so I'm closing this issue as we don't have any further action here. |
I'm still getting this issue. If I reference Microsoft.AspNetCore.Identity.UI then when I try and run this through VS it fails to start with this error: An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.Extensions.FileProviders.Physical.dll: 'The path must be absolute.'
Setting the ContainerDevelopmentMode to Regular and updating the Docker file with the alternate publish folder makes no difference. Anything else that I maybe missing? |
Hi @cowlinb6 It looks like you are posting on a closed issue! We're very likely to lose track of your bug/feedback/question unless you:
|
Just in case anyone has similar issues, the problem looks to be resolved with Visual Studio 2019 Preview (16.4.0 P1). |
I'm running the latest Preview and still have the issue. Currently i'm waiting for the next visual studio and the .net core release. |
same here. I'm using VS2019 16.3.9 and occasionally I get System.IO.DirectoryNotFoundException: C:\root.nuget\packages\microsoft.aspnetcore.identity.ui\3.0.0\staticwebassets\V4\ wenn starting the app directly. Surprisingly the error disappears when swithing to IIS and back. |
From @Thananji on Wednesday, June 26, 2019 3:43:36 AM
I created a web application (Razor pages) in dot core 3.0 preview 6 with individual user accounts in-app selected and enabled the docker support for Linux.
When I run the application, I got the error "System.ArgumentException: 'The path must be absolute.'" in CreateHostBuilder(args).Build().Run() method of Program.cs.
Am I missing anything or Is it a bug? Is there any workaround for this?
Thanks in advance?
Copied from original issue: dotnet/installer#2644
The text was updated successfully, but these errors were encountered: