vb.net中的Windows应用程序无法运行 [英] windows application in vb.net not run

查看:159
本文介绍了vb.net中的Windows应用程序无法运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visual Studio 2005 .net 2.0和sql server2005创建一个Web应用程序和一个Windows应用程序,并且操作系统是Windows XP SP2
我的Web应用程序在我的系统上运行良好,Windows应用程序最后也没有任何错误.
现在,我在客户端系统上安装了相同的Web应用程序和Windows应用程序,他在Windows Server 2003中使用.net 2.0.
他的Web应用程序运行正常,没有任何错误,但是Windows应用程序开始显示-
消息框时 指定的参数超出范围.参数名称:站点"
我以为这个错误是在Windows应用程序中读取我的web.config时发生的(我需要读取web.config才能连接到sql server)
这是Windows应用程序的代码-

I create a web application and a windows application using visual studio 2005 .net 2.0 and sql server2005 and OS is windows xp sp2
My web application runs fine at my system also windows application does not have any error at my end.
Now then i install that same web application and windows application at my client system he is using .net 2.0 with windows server 2003
his web application is running fine without any error but windows application when started giving message box like -
"The specified argument is out of range. Parameter name : site"
i thought that this error was comes at time reading my web.config in windows application (i need to read web.config for connection to sql server)
This is code of windows application-

Imports System.Web.Configuration
......
Public Class Form1
...
...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
....
Dim Str1 As Configuration.Configuration = WebConfigurationManager.OpenWebConfiguration("\myvirtualdirectory\")
Try
Value = Str1.ConnectionStrings.ConnectionStrings("Conn").ConnectionString
Catch exa As Exception
MsgBox("Error at reading Configuration :" & vbCrLf & exa.Message.ToString)
Me.lblShowError.Text = "Configuration not read"
Exit Sub
End Try
....
End Sub
.....
End Class


这是我的web.config,可以在"c:\ inetpub \ wwwroot \ myvirtualdirectory"文件夹中找到-


And here is my web.config which can be find in "c:\inetpub\wwwroot\myvirtualdirectory" folder-

<configuration> <xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <connectionstrings>
        <remove name="LocalSqlServer">
        <add name="LocalSqlServer" connectionstring="Data Source=localhost;Initial Catalog=ASPNETDB;Persist Security Info=True;integrated security=true" providername="System.Data.SqlClient"></add>
        <add name="rptServerName" connectionstring="http://localhost/reportServer"></add>
        <add name="Conn" connectionstring="Data Source=localhost;Initial Catalog=dbname;Persist Security Info=True;User ID=imuser;Password=pwd;" providername="System.Data.SqlClient"></add>
    </remove>
    <system.web>
        <identity impersonate="true"></identity>
        <sessionstate timeout="100" mode="InProc" stateconnectionstring="LocalSqlServer" cookieless="false">
        <authentication mode="Forms">
            <forms name="form1" loginurl="index.aspx" protection="All">
                <credentials passwordformat="Clear">
                    <user name="abc" password="xyz"></user>
                </credentials>
            </forms>
        </authentication>
        <authorization>
            <allow verbs="enterSharedScope" users="*" roles="Admin"></allow>
        </authorization>
        <httphandlers>
            <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"></add>
        </httphandlers>
        <compilation debug="true">
            <assemblies>
                <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"></add>
                <add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"></add>
            <buildproviders>
                <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"></add>
            </buildproviders>
        </assemblies>
    </compilation>
</sessionstate></system.web></connectionstrings></configuration>


但是我认为这不会对您有所帮助,因为似乎问题不在web.config上,因为我的网站在同一台机器上的iis运行良好(也让您知道在另一台机器上我在同一端安装了Windows 2003 Server的情况)应用程序已成功运行),但在客户端未运行.然后我在Windows应用程序的代码中找到了单词站点. (在vs 2005中),然后我在app.menifest中得到它.
这就是它的全部清单-


But i don''t think it will help you because seems problem is not with web.config as my site is running well with iis on same machine (also Let you know that on other machine i install with windows 2003 server at my end same application is running successfully) but at client end it not run. then i find word site in my code of windows app. (in vs 2005) then i got it in app.menifest.
here is whole manifest as it is-

<asmv1:assembly manifestversion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!--<assemblyIdentity version="1.0.0.0" name="MyApplication.app"></assemblyIdentity>-->
<trustinfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <!--<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
      -->
      <applicationrequestminimum>
        <defaultassemblyrequest permissionsetreference="Custom">
<permissionset class="System.Security.PermissionSet" version="1" unrestricted="true" id="Custom" samesite="site"></permissionset>
      </defaultassemblyrequest>
    </applicationrequestminimum>
  </security>
</trustinfo></asmv1:assembly>


因此,如果我删除了app.manifest中的注释文本,则也不会出现错误更改.如果我从项目中删除app.menifest,则不会出现错误消息,但应用程序也无法运行

表示没有运行,没有错误

我对此表示感谢!


So if i remove the commented text in app.manifest then also no change in error. and if i remove app.menifest from my project then the error message not appear but application is also not run

means no run, no error

i appreciate any help in this !

推荐答案

它说,您处理称为site的参数的代码有问题.如果您可以进行检查,那就太好了.
It says there is something wrong with the code where you deal with parameter called site. It would be good if you can check that.


这篇关于vb.net中的Windows应用程序无法运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆