-
Notifications
You must be signed in to change notification settings - Fork 55
MacOS error while starting the Blazor.Server-Project #216
Comments
BlazorMobile default deployment has never been tested on MacOS. There is some events that should be done at build time, same, i never tested on it. For the BlazorXamarin error, can you double check that your project is loading blazormobile.js in your index.html file ? Otherwise, keep in mind that the iOS deployment will not work on the simulator (at least the Web part, native is ok) because Apple decided to not support WebAssembly inside the iOS Simulator. So yes, if you don't have any Apple device, you can at least test the remote debugging functionnality with Server mode on MacOS and Native in the simulator. I will try to do some test on my Mac tomorrow to see why it doesn't work by default. |
Thank you so much for the quick response. I didn't know that the iOS Simulator isn't supporting WebAssembly, good to know this thanks. I. will try this later on but I tried it also on my Windows PC and by default I am getting the same error when I start the BlazorMobile.Server . The blazormobile.js is in index.html as <script> but how can I do the double check? Does the BlazorMobile work for Android? I would build up there instead of the iOS appliaction. |
Alright now I saw this in my console: |
Yes, BlazorMobile work with iOS, Android, UWP and with Electron for Desktop. So it works fine with Android, with a real device or a simulator. I'm unable to reproduce your error even with a freshly created project. Can you check this:
|
Hello, thank you again, I did the following steps, and here are the results:
|
In the end i think it's more about a Razor Class Library functionnality bug. All my tests are for now made from VS2019 Preview. You can find more informations about RCL issue here: https://stackoverflow.com/questions/60040793/404-with-static-content-in-razor-class-library-rcl One "dirty" quick workaround for now if you want to test and fix this issue later, would be to:
But beware, by doing this, the file will not be automatically synchronized if some changes are done in the future in the plugin, as you will reference your own version of the file. This workaround is mainly for you to test. Oddly, i don't have any issue on my side with the same scenario and project name. |
I am using on Mac Visual Studio 2019 Community and on Windows Visual Studio 2019 Enterprise. Is it possible to add in an already existing Blazor WebAssembly the BlazorMobile? I mean like the additional Xamarin.Forms and add the NuGet-Packages to these also on the Blazor.Client? If yes I would try to rebuild it with the Blazor.Server I have built. |
I have seen that sometime it may be problematic in some case if the current user folder as a space, as the space may be interpreted as a end of a path declaration. I'm not saying that you have this bug here, but it's just a sanity check as someone had some issue for this reason. Yes of course you can use your own Blazor WebAssembly project with BlazorMobile. The only thing is that i didn't write any Step by Step tutorial to do this for now, and even if i do it, it would be nice to write the "extended" version of this guide, meaning how to convert your Blazor web app stucture to a structure compatible with web (standalone) and mobile deployment at the same time. Unfortunately, i'm a little busy theses days, si i can't write this yet. I possible, can you please try with Visual Studio 2019 Enterprise Preview on Windows ? https://visualstudio.microsoft.com/fr/vs/preview/ Also, feel free to post here a ZIP file with your buggy project, that i can test on my machine. |
Yes, a documentation for the integration of BlazorMobile into an existing Blazor WebAssembly project would be really great! I have tried it to add empty Xamarin.Forms and manually install all packages like in the template but can't get it running. With Xamarin.Forms I am getting rollback errors so I tried adding only the Android Application and add all NuGet packages but this was also not working for me. And if I got it running there were Internal 500 Errors.. I am doing something wrong I guess. The .zip was too big to upload it here, so I just pushed it into this repository: https://github.com/brstkr/BlazorMobileTemplate But as I said the code is untouched it is just the template for creating the project with this command: |
I will take a look tomorrow |
Can this exception be occured by any
"MyProjectName.Blazor.Server": {
"commandName": "Project",
/* "launchUrl": "http://localhost:5080/" <--- commented this part out */
"environmentVariables": {
"ASPNETTCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
} Also, I took the part in ...
//.UseKestrel(options =>
//{
//options.Listen(IPAddress.Loopback, 5080);
//})
... With these changes the Server-Project worked again. PS: On Windows didn't work either without these changes, also the steps updating .NET Core SDK, using VS 2019 Enterprise Preview and clearing all caches of the server project were without any success. |
When you say "it worked again" does this mean that the blazormobile.js file loaded ? The cause and consequence seems weird to me (and more likely a bug somewhere, but don't know if it's related to this project or ASP.NET Core). Listening on port 5080 is totally arbitrary, but this change is done in order to force Kestrel to launch in HTTP mode for the tests, instead of the default HTTPS. Why ? It can of course load with HTTPS, but you may have an exception (but feel free to test) when the Blazor Server app will try to remote debug your specified endpoint (IP / Port). In order to communicate with the native side (either when deployed or for debugging purpose), the Web app try to connect to a websocket endpoint. If you are in HTTPS mode, the browser may enforce you to use the WSS protocol instead of WS, and as the native end does not carry any WSS / Certificate encryption, it will fail to communicate. But i don't have done tests on this scenario recently. Are you able to communicate with a deployed Android app from your browser, when you set the correct IP (targeting the IP of your Android device), even with HTTPS enabled in your server project ? |
No, it was kinda (working). The blazormobile.js was loading but were unable to connect and the WebSocket connection was not working("net::ERR_CONNECTION_REFUSED"). Communication with Android will probably not work. |
Interesting. I remember someone that had exactly the same problem with static resources returning 404 while using "project deployment" but working while using IIS Express. I don't know from where this error is coming, i can be wrong but this strange behavior with static resource is a .NET Core issue in my opinion, but i can be wrong. If IIS Express mode is working with default template, you should be ok to do remote debugging with Android (or iOS, or anything) if you set every IP / Port correctly like stated in the doc. Maybe an additional bit to check, any Firewall configuration that would prevent connecting, if you have issue. |
Btw, I never got the web socket connection working properly, I always get that socket error @brstkr just mentioned above. |
@arivera12 This is mandatory for remote debugging. Please check :
|
Let me give it a try |
Hi, this article will help How to deal with the "HTTP 404 '_content/Foo/Bar.css' not found" when using Razor component package on ASP.NET Core Blazor app, now it works for me. |
Thanks for the report ! I will try to address this in the doc in the future |
I am using Visual Studio 2019 for MacOS and just followed the getting started section of the readme. Creating a project and trying to debug without doing any changes to it.
Selecting Blazor.Server project and debugging gave me couple of errors and the website was only on "Loading..." .
Inspecting it in the Browser gave me these errors:
The package manager integrated in Visual Studio gave me these errors:
I don't actually know what the problem is. I have updated the xamarin forms too.
I was trying to work with the iOS project. I am using xcode-simulator as debugging option for that and therefore I tried to debug the Server to get it running.
The text was updated successfully, but these errors were encountered: