none
win8 metro怎么向系统推送一个WLAN profile,然后系统自动连接这个profile? RRS feed

答案

  • xml文件改成  
    <?xml version="1.0" encoding="utf-8"?>
    <CarrierProvisioning xmlns="http://www.microsoft.com/networking/CarrierControl/v1">
      <Global>
        <!-- Adjust the Carrier ID to fit your own ID. Refer to the MSDN documentation about Carrier ID's. -->
        <CarrierId>{11111111-1111-1111-1111-111111111111}</CarrierId>
        <!-- Adjust the Susbscriber ID. Refer to the MSDN documentation about Subscriber ID's. -->
        <SubscriberId>1234567890</SubscriberId>
      </Global>
      <WLANProfiles>
        <WLANProfile xmlns="http://www.microsoft.com/networking/CarrierControl/WLAN/v1">
          <!-- Adjust the profile name to have a human readable network name. By default this equals the SSID. -->
          <name>sap</name>
          <SSIDConfig>
            <SSID>
              <!-- Adjust the SSID name to fit the SSID of the hotspot. -->
              <name>sap</name>
            </SSID>
          </SSIDConfig>
          <MSM>
            <security>
              <authEncryption>
                <authentication>WPA2PSK</authentication>
                <encryption>AES</encryption>
                <useOneX>false</useOneX>
              </authEncryption>
              <HotspotProfile xmlns="http://www.microsoft.com/networking/WLAN/HotspotProfile/v1">
                <ExtAuth>
                  <!-- Adjust the extension ID to match the package family name of the application running the background task handler. -->
                  <ExtensionId>Microsoft.SDKSamples.HotspotAuthentication.JS_8wekyb3d8bbwe</ExtensionId>
                </ExtAuth>
              </HotspotProfile>
            </security>
          </MSM>
        </WLANProfile>
      </WLANProfiles>
    </CarrierProvisioning>
    
    provision successful! 系统还是没有做connect? 
    2012年7月19日 3:49
  • Got it! Please refer to URL:  http://msdn.microsoft.com/en-us/library/windows/apps/hh868398.aspx

    对于加密的网络,要加上sharedKey标签。

      
    2012年7月19日 7:25

全部回复

  • 准备一个符合 CarrierControlSchema schema 的Wifi Profile的XML文件(参考 http://blogs.msdn.com/b/dimeby8/archive/2011/11/01/sample-xml-document-for-provisioningagent-provisionfromxmldocumentasync.aspx),然后利用 ProvisioningAgent.ProvisionFromXmlDocumentAsync 方法向系统推送一个Wifi Profile。 参考下:Mobile broadband account provisioning sample http://code.msdn.microsoft.com/windowsapps/ProvisioningAgent-Modern-19afe43b


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    2012年7月18日 3:46
    版主
  • 如果想连接一个SSID为sap,加密类型为AES,认证类型为WPA2,密码为111111的profile,xml文件格式该怎么写? 我想在推送给系统成功后,系统能连接我推送的这个profile。 目前我的xml如下:

    <?xml version="1.0" encoding="utf-8"?>
    <CarrierProvisioning xmlns="http://www.microsoft.com/networking/CarrierControl/v1">
      <Global>
        <!-- Adjust the Carrier ID to fit your own ID. Refer to the MSDN documentation about Carrier ID's. -->
        <CarrierId>{11111111-1111-1111-1111-111111111111}</CarrierId>
        <!-- Adjust the Susbscriber ID. Refer to the MSDN documentation about Subscriber ID's. -->
        <SubscriberId>1234567890</SubscriberId>
      </Global>
      <WLANProfiles>
        <WLANProfile xmlns="http://www.microsoft.com/networking/CarrierControl/WLAN/v1">
          <!-- Adjust the profile name to have a human readable network name. By default this equals the SSID. -->
          <name>sap</name>
          <SSIDConfig>
            <SSID>
              <!-- Adjust the SSID name to fit the SSID of the hotspot. -->
              <name>sap</name>
            </SSID>
          </SSIDConfig>
          <MSM>
            <security>
              <authEncryption>
                <authentication>WPA2</authentication>
                <encryption>AES</encryption>
                <useOneX>false</useOneX>
              </authEncryption>
              <HotspotProfile xmlns="http://www.microsoft.com/networking/WLAN/HotspotProfile/v1">
                <ExtAuth>
                  <!-- Adjust the extension ID to match the package family name of the application running the background task handler. -->
                  <ExtensionId>Microsoft.SDKSamples.HotspotAuthentication.JS_8wekyb3d8bbwe</ExtensionId>
                </ExtAuth>
              </HotspotProfile>
            </security>
          </MSM>
        </WLANProfile>
      </WLANProfiles>
    </CarrierProvisioning>

    签名过后运行没有问题,推送却不成功,错误信息为:<?xml version="1.0"?><CarrierProvisioningResults><WLANProfiles><WLANProfile name="sap" errorCode="800704b6"/></WLANProfiles></CarrierProvisioningResults>  请问怎么才能让系统连接这个wifi profile呢?


    2012年7月18日 8:45
  • 你把签好名的文件用记事本打开,如果你是C# 或者JS的项目的话,re-save用ASCII编码,基于此贴 http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/b1b43b4a-39dd-4ef8-8d5c-dc2381c9661c

    让系统认证连接,参考此例:http://code.msdn.microsoft.com/windowsapps/Wi-Fi-hotspot-authenticatio-943569eb


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    2012年7月18日 10:02
    版主
  • xml文件改成  
    <?xml version="1.0" encoding="utf-8"?>
    <CarrierProvisioning xmlns="http://www.microsoft.com/networking/CarrierControl/v1">
      <Global>
        <!-- Adjust the Carrier ID to fit your own ID. Refer to the MSDN documentation about Carrier ID's. -->
        <CarrierId>{11111111-1111-1111-1111-111111111111}</CarrierId>
        <!-- Adjust the Susbscriber ID. Refer to the MSDN documentation about Subscriber ID's. -->
        <SubscriberId>1234567890</SubscriberId>
      </Global>
      <WLANProfiles>
        <WLANProfile xmlns="http://www.microsoft.com/networking/CarrierControl/WLAN/v1">
          <!-- Adjust the profile name to have a human readable network name. By default this equals the SSID. -->
          <name>sap</name>
          <SSIDConfig>
            <SSID>
              <!-- Adjust the SSID name to fit the SSID of the hotspot. -->
              <name>sap</name>
            </SSID>
          </SSIDConfig>
          <MSM>
            <security>
              <authEncryption>
                <authentication>WPA2PSK</authentication>
                <encryption>AES</encryption>
                <useOneX>false</useOneX>
              </authEncryption>
              <HotspotProfile xmlns="http://www.microsoft.com/networking/WLAN/HotspotProfile/v1">
                <ExtAuth>
                  <!-- Adjust the extension ID to match the package family name of the application running the background task handler. -->
                  <ExtensionId>Microsoft.SDKSamples.HotspotAuthentication.JS_8wekyb3d8bbwe</ExtensionId>
                </ExtAuth>
              </HotspotProfile>
            </security>
          </MSM>
        </WLANProfile>
      </WLANProfiles>
    </CarrierProvisioning>
    
    provision successful! 系统还是没有做connect? 
    2012年7月19日 3:49
  • Got it! Please refer to URL:  http://msdn.microsoft.com/en-us/library/windows/apps/hh868398.aspx

    对于加密的网络,要加上sharedKey标签。

      
    2012年7月19日 7:25
  • 额,你的速度比我快, 我还在看大量的 Mobile Boardband文档,还没有到这一块。不错。大家共同学习了。

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    2012年7月19日 8:00
    版主
  • hi Bob,目前还有个问题就是 如果加上这三个标签还是会抛出错误:0x82170002 (PROVCORE_E_XML_INVALID): XML does not match the provisioning schema 
        <connectionType>ESS</connectionType>
        <connectionMode>auto</connectionMode>
        <autoSwitch>false</autoSwitch>
    看文档上说这样写没有问题,如下:
    <?xml version="1.0" encoding="US-ASCII"?>
    <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
        <name>SampleWPA2PSK</name>
        <SSIDConfig>
            <SSID>
                <name>SampleWPA2PSK</name>
            </SSID>
        </SSIDConfig>
        <connectionType>ESS</connectionType>
        <connectionMode>auto</connectionMode>
        <autoSwitch>false</autoSwitch>
        <MSM>
            <security>
                <authEncryption>
                    <authentication>WPA2PSK</authentication>
                    <encryption>AES</encryption>
                    <useOneX>false</useOneX>
                </authEncryption>
                <sharedKey>
                    <keyType>passPhrase</keyType>
                    <protected>false</protected>
                    <keyMaterial> <!-- insert key here -->                       </keyMaterial>
                </sharedKey>
            </security>
        </MSM>
    </WLANProfile>
    不知道为何会抛出异常?

    2012年7月19日 10:09
  • Wi-Fi-hotspot-authenticatio 例子profile element 可参考这个URl http://msdn.microsoft.com/en-us/library/windows/apps/hh868398.aspx

     用如下xml,如果不手动选中自动连接,推送成功但不会做连接。怎么添加wifi的自动连接选项(connectionMode tag)??? 

    <?xml version="1.0" encoding="utf-8"?>
    <CarrierProvisioning xmlns="http://www.microsoft.com/networking/CarrierControl/v1">
      <Global>
        <!-- Adjust the Carrier ID to fit your own ID. Refer to the MSDN documentation about Carrier ID's. -->
        <CarrierId>{11111111-1111-1111-1111-111111111111}</CarrierId>
        <!-- Adjust the Susbscriber ID. Refer to the MSDN documentation about Subscriber ID's. -->
        <SubscriberId>1234567890</SubscriberId>
      </Global>
      <WLANProfiles>
        <WLANProfile xmlns="http://www.microsoft.com/networking/CarrierControl/WLAN/v1">
          <!-- Adjust the profile name to have a human readable network name. By default this equals the SSID. -->
          <name>ssidname</name>
          <SSIDConfig>
            <SSID>
              <!-- Adjust the SSID name to fit the SSID of the hotspot. -->
              <name>ssidname</name>
            </SSID>
          </SSIDConfig>  
          <MSM>
            <security>
              <authEncryption>
                <authentication>WPA2PSK</authentication>
                <encryption>AES</encryption>
                <useOneX>false</useOneX>
              </authEncryption>
    		  <sharedKey>
    			<keyType>passPhrase</keyType>
    			<protected>false</protected>
    			<keyMaterial>password</keyMaterial>
    		  </sharedKey>
            </security>
          </MSM>
        </WLANProfile>
      </WLANProfiles>
    </CarrierProvisioning>
    

     
    2012年7月20日 7:53
  • Hi everybody.

    Anyone knows? thanks!

    2012年7月27日 6:16