.NET Framework应用中如何在Windows 11搭建Wi-Fi热点
问题:在Windows 11的.NET Framework应用中实现Wi-Fi热点启停
需求
- 在Windows 11系统的.NET Framework应用中实现Wi-Fi热点的启动与关闭
已排除方案
- 排除使用环回适配器及PowerShell脚本,因该适配器为测试用途,不适用于当前场景
遇到的问题
- 尝试使用
Windows.Devices.WiFiAPI时,调用WiFiAdapter.FindAllAdaptersAsync()报错:System.Exception: The handle is invalid - 调用
WiFiAdapter.RequestAccessAsync()返回DeniedBySystem,推测需要获取Wi-Fi访问权限
已尝试操作
添加了package.appxmanifest文件,但未解决问题,文件内容如下:
<?xml version="1.0" encoding="utf-8"?> <Package xmlns="http://schemas.microsoft.com/appx/2010/manifest"> <Identity Name="WirelessHotspotService" Version="1.0.0.0" Publisher="CN=Company, O=Company, L=City, S=County, C=UK" /> <Properties> <DisplayName>WirelessHotspotService</DisplayName> <PublisherDisplayName>Company</PublisherDisplayName> <Logo>images\logo.png</Logo> </Properties> <Prerequisites> <OSMinVersion>26200.6584</OSMinVersion> <OSMaxVersionTested>26200.6584</OSMaxVersionTested> </Prerequisites> <Resources> <Resource Language="en-GB" /> </Resources> <Applications> <Application Id="WirelessHotspotService" StartPage="default.html"> <VisualElements DisplayName="Wireless Hotspot Service" Description="Service that allows other app to start and stop the wireless hotspot." Logo="images\logo.png" SmallLogo="images\logo_small.png" ForegroundText="dark" BackgroundColor="white"> <SplashScreen Image="images\splash.png" /> </VisualElements> </Application> </Applications> <Capabilities> <Capability Name="wiFiControl"/> <Capability Name="onDemandHotspotControl"/> </Capabilities> </Package>
寻求解决方案
如何在.NET Framework应用中搭建Wi-Fi热点?
内容的提问来源于stack exchange,提问作者Matt Ellen
相关产品推荐
相关产品推荐

