我正在开发控制台应用程序,当我运行.exe文件时,我收到以下错误.
system.Configuration.ConfigurationErrorsException:
system.Configuration.ConfigurationErrorsException
每个配置文件只允许一个 元素,如果存在,则必须是根<configSections>
元素的第一个子元素.
App.config文件是
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
<configSections>
<section name="Reva.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<!-- ... -->
Run Code Online (Sandbox Code Playgroud)
如果我删除了
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
Run Code Online (Sandbox Code Playgroud)
然后它工作正常.
我正在使用C#代码启动和停止窗口服务,但我收到此错误.
System.ComponentModel.Win32Exception: Access is denied
Run Code Online (Sandbox Code Playgroud)
我的代码:
public void StartService(string serviceName, int timeoutMilliseconds)
{
ServiceController service = new ServiceController(serviceName);
try
{
TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds);
service.Start();
service.WaitForStatus(ServiceControllerStatus.Running, timeout);
lblMessage.Text = "Service Started.";
}
catch (Exception ex)
{
//lblMessage.Text = "Error in Service Starting.";
lblMessage.Text = ex.ToString();
}
}
Run Code Online (Sandbox Code Playgroud) 我在我的wpf应用程序中使用"WebBroswer"来呈现Google地图.所以我用我的c#代码调用一些参数的Pan(x,y)JavaScript方法.
但我得到以下错误.
名字不明.(来自HRESULT的异常:0x80020006(DISP_E_UNKNOWNNAME))
我的Window2.xaml文件:
<Window x:Class="Test.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="300" Width="300">
<Grid>
<WebBrowser Name="mapBrowser" Margin="50" />
<Button Name="button1" VerticalAlignment="Bottom" Click="button1_Click">Button</Button>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
我的Window2.xaml.cs文件:
namespace Test
{
/// <summary>
/// Interaction logic for Window2.xaml
/// </summary>
public partial class Window2 : Window
{
public Window2()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
Uri uri = new Uri(@"pack://application:,,,/HTMLPage1.htm");
Stream source = Application.GetContentStream(uri).Stream;
mapBrowser.NavigateToStream(source);
this.mapBrowser.InvokeScript("Pan", x, y);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的HTML页面:
<html>
<head>
<title></title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script …
Run Code Online (Sandbox Code Playgroud) 我是WPF的新手.我在我的wpf应用程序中使用"WebBroswer"来渲染Google地图.我有一个googlemap.htm页面,它包含一个初始化(lat,log)JavaScript函数.现在我想从带有lat和log参数的.xaml.cs文件中调用此函数.
Googlemap.htm
<script>
function initialize(lat, log) {
var mapProp = {
center: new google.maps.LatLng(lat, log),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
Run Code Online (Sandbox Code Playgroud) 以下SQL Server 2008语句有什么区别?
SELECT COUNT(*) FROM dbo.Regular_Report
SELECT COUNT(0) FROM dbo.Regular_Report
SELECT COUNT(1) FROM dbo.Regular_Report
SELECT COUNT(100) FROM dbo.Regular_Report
SELECT COUNT(ID) FROM dbo.Regular_Report
Run Code Online (Sandbox Code Playgroud) asp.net ×2
browser ×2
c# ×2
google-maps ×2
iis-7 ×2
javascript ×2
wpf ×2
wpf-controls ×2
app-config ×1
iis ×1
iis-7.5 ×1
sql ×1