Blazor 不提供单独的会话。如何修复?
我有一个托管在 Azure 应用服务上的 Blazor 服务器应用,该应用与通过 Azure 上的 VNET 连接的本地服务器进行通信。
我有自定义身份验证,用户将使用其登录凭据,该登录凭据在返回令牌的本地服务器中进行验证。
现在我的问题是,似乎没有该应用程序的单独实例。 我之所以得出这个结论,是因为我遇到了以下情况:
我有一个 ZXing 条码扫描仪,它以以下方式显示解码后的条码:
<input type='text' value='@Barcode' disabled="disabled" />
一旦找到条码,该值就会显示在文本框中。
这是我的问题:
- 在我的手机和PC上使用实时网址打开应用程序
- 我扫描手机上的代码
- PC的文本框已更新为我刚刚的代码用我的手机扫描的?
我是否缺少特定配置或者我误解了 Blazor 的工作原理?
I have a Blazor Server app hosted on an Azure App Service, which communicates to an on-premises server connected through a VNET on Azure.
I have custom authentication in place where a user will use their login credentials which is validated in the on-premises server which returns a token.
Now my issue is that it seems like there aren't individual instances of the app.
I've come to this conclusion because of the following scenario I've encountered:
I have a ZXing barcode scanner which displays a decoded barcode in the following manner:
<input type='text' value='@Barcode' disabled="disabled" />
The value is displayed in the textbox once a barcode is found.
Here is my issue:
- Open the app using live URL on my mobile phone and on my PC
- I scan the code on my phone
- The PC's textbox is updated with the code I just scanned on my phone?
Is there a specific configuration I'm missing or am I misunderstanding how Blazor works?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

原因是 BlazorBarcodeScanner.ZXing.JS,Blazor 条形码扫描仪。
我手动实现了 JS 库,我的问题消失了。
The cause was the BlazorBarcodeScanner.ZXing.JS, Blazor barcode scanner .
I manually implemented the JS library and my problem disappeared.