相关疑难解决方法(0)

远程服务器返回错误:(403)禁止

我已经编写了一个可以运行数月的应用程序,在过去的几天里我只在安装的版本上收到了以下错误.

如果我在VS中运行源代码一切正常.此外,bin文件夹中的.exe工作正常.它只是生成错误的已安装版本,如果我重新编译并重新安装,我会得到相同的错误.

关于造成这种情况的原因我有点难过,希望能指点一下.它似乎是通过IE的WebRequest响应没有返回,但我很难过为什么它在VS中正常工作没有任何错误.是否有任何新的IE安全措施/政策可能导致此问题?

到目前为止我尝试过的事情包括:

  • 禁用所有AntiVirus和防火墙
  • 以管理员身份运行

例外情况:

Exception: System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'XApp.MainWindow' that matches the specified binding constraints threw an exception. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
   at System.Net.HttpWebRequest.GetResponse()
   at XApp.HtmlRequest.getHtml(Uri uri) in J:\Path\MainWindow.xaml.cs:line 3759
   at XApp.MainWindow.GetLinks() in J:\Path\MainWindow.xaml.cs:line 2454
   at XApp.MainWindow..ctor() in J:\Path\MainWindow.xaml.cs:line 124
   --- End of inner exception stack trace ---
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, …
Run Code Online (Sandbox Code Playgroud)

c#

24
推荐指数
2
解决办法
16万
查看次数

标签 统计

c# ×1