新闻建站cms系统、政府cms系统定制开发

广州网站建设公司-阅速公司

asp.net新闻发布系统、报纸数字报系统方案
/
http://www.ysneo.com/
广州网站建设公司
您当前位置:首页>网站技术

网站技术

WebRequest:System.Net.WebException: 远程服务器返回错误: (404) 未找到

发布时间:2015/1/27 16:35:28  作者:Admin  阅读:3166  

广告:阿里云采购优惠专区

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

此包运行出现如下错误:

“/”应用程序中的服务器错误。

远程服务器返回错误: (404) 未找到。

说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Net.WebException: 远程服务器返回错误: (404) 未找到。

源错误:

行 79: //ie10 User-Agent Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)

行 80: //req.Headers.Add("User-Agent", "ie9");

行 81: res = (HttpWebResponse)req.GetResponse();

行 82: Stream resStream = res.GetResponseStream();

行 83: StreamReader reader = new StreamReader(resStream, Encoding.GetEncoding(encodingStr));

源文件: E:\aspnet2.0\53BK公司网站-net-家里\Mvccom\GetHtml.cs 行: 81

堆栈跟踪:

[WebException: 远程服务器返回错误: (404) 未找到。]

System.Net.HttpWebRequest.GetResponse() +5411389

Mvccom.GetHtml.GetPageSource_Mobile(String url, String encodingStr) in E:\aspnet2.0\53BK公司网站-net-家里\Mvccom\GetHtml.cs:81

Mvcb2b.Controllers.ToolsController.Mobileshow() in E:\aspnet2.0\53BK公司网站-net-家里\Mvcb2b\Controllers\ToolsController.cs:57

lambda_method(ExecutionScope , ControllerBase , Object[] ) +75

System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17

System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178

System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24

System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +52

System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +254

System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +19

System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +192

System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +314

System.Web.Mvc.Controller.ExecuteCore() +105

System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +39

System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7

System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +34

System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21

System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12

System.Web.Mvc.Async.WrappedAsyncResult`1.End() +59

System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44

System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +7

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8769966

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

版本信息: Microsoft .NET Framework 版本:2.0.50727.5485; ASP.NET 版本:2.0.50727.5483

原因:formurl = Request.Form["http_txt"].ToString().Trim().ToLower();

解决方法:去掉 ToLower()就正常了。

广告:阿里云新人采购专场

相关文章
WebRequest
404
cms新闻系统购买咨询
扫描关注 广州阅速软件科技有限公司
扫描关注 广州阅速科技