Skip to content
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

I cannot deploy WASM to IIS #16015

Open
TopperDEL opened this issue Mar 25, 2024 · 11 comments
Open

I cannot deploy WASM to IIS #16015

TopperDEL opened this issue Mar 25, 2024 · 11 comments
Labels
difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working kind/papercut Issue that is especially relevant to users beginning to use Uno platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform

Comments

@TopperDEL
Copy link
Contributor

Current behavior

I have multiple problems. Either the publish fails with "file is locked" or the published app is not accessable or - the current error - it states that "there is no target for net8.0/win-x64".

I'll start with the "no target"-error:
msbuild.zip

This is a follow-up-issue from #14637 .

Expected behavior

The deploying of a freshly created WASM-app to IIS should work.

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

None, yet

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

No response

Affected platforms

WebAssembly

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@TopperDEL TopperDEL added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Mar 25, 2024
@TopperDEL
Copy link
Contributor Author

I just created a new app, tried Windows (works), tried WASM locally (works), created a publish profile and tried to publish and got the "IISDEployTest.Wasm.dll is used by another process".

The binlog for this error (it is a different project then the above!) is here:
msbuild.zip

@TopperDEL
Copy link
Contributor Author

TopperDEL commented Mar 25, 2024

Now I managed to get a deployment working. The site in IIS now looks like this:

image

It feels like the site is using the wrong directory. But as mentioned in #14637 I see no other way to create a site and deploy to it.

Comparing it to another - older - app built with Uno, the web.config is found in the root dir while the new one does not deploy one. The new ony only puts a web.config in the subfolder "wwwroot". But besides that I see no difference in configuration.

@jeromelaban jeromelaban added the platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform label Mar 25, 2024
@TopperDEL
Copy link
Contributor Author

TopperDEL commented Mar 26, 2024

Ok, I just realized, that the template also creates a server project that serves the WASM-App, too. So I do not need to deploy the WASM-project itself but I can simply deploy the Server-project. That works flawlessly as expected!

So if this is the way to go, then I'm fine. If WASM still should be deployable by its own (what I assume, though), the above errors are still there.

But for me, the server-project is good enough and works!

Sometimes I'm wondering about myself: I'm following Uno-development very closely and read every news and blog post. But I seemed to miss this one.

@jeromelaban
Copy link
Member

Thanks for the update @TopperDEL. The wasm project should be deployable indeed. I may have missed this, but did you try using dotnet publish from the command line?

@TopperDEL
Copy link
Contributor Author

Yes, I did. But it lead to nearly the same issue - though I'm not quite sure if it was due to missing password or so. So maybe the reason for failing deploy was different.

@TopperDEL
Copy link
Contributor Author

TopperDEL commented May 22, 2024

I just stumbled across this problem again. I could not publish the WASM-Head to IIS. Then I tried to do it using the terminal and dotnet publish. That lead me to an issue: I have one main uno-app (already on 5.2) that is using central package management. The app I would like to deploy now is in a subfolder of the other app and is on Uno 5.1 and is NOT using central package management. But if I do not define that explicitly, it finds the Directory.Packages.propsfrom the 5.2-app and I got the error that I must not define the package version when using the central package management.
I could overcome this by explicitly set <ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally> in the "sub-uno-project".

Then the publish with dotnet publish worked, but I still cannot access the app. "You are not allowed to access the directory or page". I think there is some web.config-setting missing now.
I am still unable to publish it using Visual Studio. There the publish fails with "project.assets.json does not contain a target for net8.0/win-x64" (NETSDK1047).

@TopperDEL
Copy link
Contributor Author

After adding <RuntimeIdentifiers>win-x64</RuntimeIdentifiers> to my WASM-head I could deploy it, but still have issues with the app not being accessable. I think I'm missing some mime-types or so in the ISS-site-config.

What really confuses me is this doc. I do not know how to set the physical path. If I create a site I need to define which folder it uses. Then I deploy the app and would expect the folder to contain the app itself - not necessarily in a subfolder. So there is no other way to "set a physical path" to another subfolder of my site.

@TopperDEL
Copy link
Contributor Author

Now I got it! the physical path of my site can be changed in the "extended settings". There I simply have to set it to the "wwwroot"-folder underneath my site-path.

Now it is working as expected! I can deploy and the site is accesable again!

I would suggest to update the doc, though. The physical path has to be set to "wwwroot", not to any "dist"-folder.

@TopperDEL
Copy link
Contributor Author

Sorry, I have to re-open this.

Every consecutive deploy now writes below the "wwwroot"-physical path in IIS. So changing the physical path for the site is not the way to go.

I create a new site:
c:\inetpub\wwwroot\myapp\

I deploy my site using VS:
c:\inetpub\wwwroot\myapp\wwwroot

I change the physical path and re-deploy - making the app unusable again:
c:\inetpub\wwwroot\myapp\wwwroot\wwwroot

The problem is: I need a web.config in the myapp-folder that configures the redirection to the wwwroot. This should be created by the deployment-task - or the deployment should not create a "deeper" path (appending "wwwroot").

@jeromelaban
Copy link
Member

Thanks for the updates. Could you create a step-by-step repro scenario that shows the issue? I'm also wondering if it's something that got fixed in 5.2 somehow with the single project.

@TopperDEL
Copy link
Contributor Author

TopperDEL commented May 23, 2024

So @jeromelaban, I just made an end-to-end-test and collected all steps I've done.

First, let's create a new app:
dotnet new unoapp -o iistest

And create a new site in IIS:
image

Then I started win-head => working
I started wasm (iis express) => not working (obscure error)
I started wasm => working
I started wasm (iis express) => working (maybe the first run needs some initialization? - whatever)

Let's create a publish profile:
image
image
image

Started the deployment=> it fails with “…\iistest\obj\Release\net8.0-browserwasm\iistest.dll” is already in use by another process
Cleanup solution, deploy again => same error
Cleanup solution, closing VS, open Solution again, deploy again without any building in between => successful deployment

image

BUT: the website is not available:

image

“You are not allowed to view this folder or site”
The reason: there is no document to serve in the root-folder of the IIS-site:

image

Now if I change the physical path of the site from this:

image

To this:

image

It works:

image

Now let’s deploy again from VS (cleanup, closing, re-opening, deploying) – we then get another wwwroot underneath the “iistest\wwwroot”-folder and we don’t get the latest version served from IIS (as that one is one folder deeper).
The folder structure now looks like this:

image

This is exactly the error I get all the time. It seems the deployment has a wrong "ground" to start. Why does it create another wwwroot underneath my site-path? It should just deploy all files at the root. I cannot overcome this by chaning the physical path of the site as every subsequent deploy would again create a new wwwroot underneath.

@MartinZikmund MartinZikmund added difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/papercut Issue that is especially relevant to users beginning to use Uno and removed triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working kind/papercut Issue that is especially relevant to users beginning to use Uno platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants