C# wpf应用程序中bing映射的凭据无效
无法显示地图。我仍然有一条错误消息: “凭据无效。请在以下位置注册开发人员帐户:” 但是,我正确创建了帐户并获得了有效密钥:C# wpf应用程序中bing映射的凭据无效,c#,wpf,xaml,bing-maps,C#,Wpf,Xaml,Bing Maps,无法显示地图。我仍然有一条错误消息: “凭据无效。请在以下位置注册开发人员帐户:” 但是,我正确创建了帐户并获得了有效密钥: 申请名称:地理 钥匙:*我的钥匙* 应用程序Url: 键类型:Basic/Dev/Test 创建日期:2015年12月8日 有效期:无 我的xaml代码: <Window x:Class="Geography.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/prese
- 申请名称:地理
- 钥匙:*我的钥匙*
- 应用程序Url:
- 键类型:Basic/Dev/Test
- 创建日期:2015年12月8日
- 有效期:无
<Window x:Class="Geography.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
Title="MainWindow" Height="350" Width="525">
<Grid>
<m:Map CredentialsProvider="*My key*">
</m:Map>
</Grid>
</Window>
试试这段代码
<Window x:Class="Geography.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
Title="Maps" Height="350" Width="525" Style="{StaticResource OfficeStyle}">
<Grid>
<m:Map CredentialsProvider="/*YOUR ID*/" x:Name="myMap" />
</Grid>
</Window>
然后将其添加到cs代码中
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Maps.MapControl.WPF;
namespace Geography
{
/// <summary>
/// Interaction logic for Maps.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
myMap.Focus();
//Set map to Aerial mode with labels
myMap.Mode = new AerialMode();
}
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
使用System.Windows;
使用System.Windows.Controls;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;
使用System.Windows.Shapes;
使用Microsoft.Maps.MapControl.WPF;
名称空间地理
{
///
///Maps.xaml的交互逻辑
///
公共部分类主窗口:窗口
{
公共主窗口()
{
初始化组件();
myMap.Focus();
//使用标签将地图设置为“空中模式”
myMap.Mode=新的天线模式();
}
}
}
转到以下链接以获取更多详细信息:这是一个代理,我忽略了它的存在 因此,我在app.config文件中设置了以下配置,错误消息不再出现:
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress="http://ProxyAddress:Port"/>
</defaultProxy>
</system.net>
现在是您的身份证问题。请先检查。如何检查钥匙?当我用我的登录连接到网站时,我在网站上看不到任何失败。谁能给我一个有效的密钥来尝试?转到以下链接以获取更多信息:我有相同的问题,但使用VPN时。微软应该在他们的文档中指出这一点。