http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 9254|回复: 10

[反馈建议] 万能框架POST一般处理程序

[复制链接]
发表于 2015-9-8 18:26:12 | 显示全部楼层 |阅读模式
最近用一般程序写了个处理数据库的,想处理了后将结果返回到页面上,在读取,就用万能框架来POST了,但是万能框架不知道为什么不能成功的POST,提示:未能解析此远程名称      


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2015-9-9 09:20:26 | 显示全部楼层
贴下代码看看
 楼主| 发表于 2015-9-9 11:08:03 | 显示全部楼层

一般处理程序代码:
string PostData = context.Request.Form["PostData"];
context.Response.Write("可以输出");


万能框架:
   //发送POST
            //创建Httphelper对象
            HttpHelper http = new HttpHelper();
            //创建Httphelper参数对象
            HttpItem item = new HttpItem()
            {
                URL = "http://www.leifengzhushou.com/fuqi/API/Test.ashx",//URL     必需项   
                Method = "post",//URL     可选项 默认为Get   
                ContentType = "application/x-www-form-urlencoded",//返回类型    可选项有默认值
                Postdata = “测试”,//Post要发送的数据
            };
            //请求的返回值对象
            HttpResult result = http.GetHtml(item);
            //获取请请求的Html
            string html = result.Html;
发表于 2015-9-9 11:21:52 | 显示全部楼层
string PostData = context.Request["PostData"];
 楼主| 发表于 2015-9-9 12:28:24 | 显示全部楼层
站长苏飞 发表于 2015-9-9 11:21
string PostData = context.Request["PostData"];

还是不行;

<html>
    <head>
        <title>运行时错误</title>
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Lucida Console";font-size: .9em}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>

            <h2> <i>运行时错误</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> 说明: </b>服务器上出现应用程序错误。此应用程序的当前自定义错误设置禁止远程查看应用程序错误的详细信息(出于安全原因)。但可以通过在本地服务器计算机上运行的浏览器查看。
            <br><br>

            <b>详细信息:</b> 若要使他人能够在远程计算机上查看此特定错误消息的详细信息,请在位于当前 Web 应用程序根目录下的“web.config”配置文件中创建一个 &lt;customErrors&gt; 标记。然后应将此 &lt;customErrors&gt; 标记的“mode”属性设置为“Off”。<br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

&lt;!-- Web.Config 配置文件 --&gt;

&lt;configuration&gt;
    &lt;system.web&gt;
        &lt;customErrors mode=&quot;Off&quot;/&gt;
    &lt;/system.web&gt;
&lt;/configuration&gt;</pre></code>

                  </td>
               </tr>
            </table>

            <br>

            <b>注释:</b> 通过修改应用程序的 &lt;customErrors&gt; 配置标记的“defaultRedirect”属性,使之指向自定义错误页的 URL,可以用自定义错误页替换所看到的当前错误页。<br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

&lt;!-- Web.Config 配置文件 --&gt;

&lt;configuration&gt;
    &lt;system.web&gt;
        &lt;customErrors mode=&quot;RemoteOnly&quot; defaultRedirect=&quot;mycustompage.htm&quot;/&gt;
    &lt;/system.web&gt;
&lt;/configuration&gt;</pre></code>

                  </td>
               </tr>
            </table>

            <br>

    </body>
</html>
发表于 2015-9-9 13:08:10 | 显示全部楼层
你放开Config看看是不是程序本身的问题,直接这样是正常的,我一直这样用,应用程序中的服务器错误 这说明是在服务器端报错了。
 楼主| 发表于 2015-9-9 14:26:43 | 显示全部楼层
站长苏飞 发表于 2015-9-9 13:08
你放开Config看看是不是程序本身的问题,直接这样是正常的,我一直这样用,应用程序中的服务器错误 这说明 ...

<html>
    <head>
        <title>配置错误</title>
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Lucida Console";font-size: .9em}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>

            <h2> <i>配置错误</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> 说明: </b>在处理向该请求提供服务所需的配置文件时出错。请检查下面的特定错误详细信息并适当地修改配置文件。
            <br><br>

            <b> 分析器错误消息: </b>无法识别的属性“targetFramework”。请注意属性名称区分大小写。<br><br>

            <b>源错误:</b> <br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

服务器上出现应用程序错误。此应用程序的当前自定义错误设置禁止远程查看应用程序错误的详细信息(出于安全原因)。但可以通过在本地服务器计算机上运行的浏览器查看。</pre></code>

                  </td>
               </tr>
            </table>

            <br>

            <b> 源文件: </b> f:\usr\LocalUser\qxw1194250212\fuqi\web.config<b> &nbsp;&nbsp; 行: </b> 9
            <br><br>

            <hr width=100% size=1 color=silver>

            <b>版本信息:</b>&nbsp;Microsoft .NET Framework 版本:2.0.50727.5485; ASP.NET 版本:2.0.50727.5491

            </font>

    </body>
</html>
<!--
[ConfigurationErrorsException]: 无法识别的属性“targetFramework”。请注意属性名称区分大小写。 (f:\usr\LocalUser\qxw1194250212\fuqi\web.config line 9)
   在 System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
   在 System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
   在 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   在 System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
   在 System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
   在 System.Web.HttpContext.GetSection(String sectionName)
   在 System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
   在 System.Web.Configuration.WebConfigurationManager.GetSection(String sectionName)
   在 System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSectionFromWebConfigurationManager(String sectionPath)
   在 System.ServiceModel.ServiceHostingEnvironment.HostingManager.ExtensionHelper..ctor()
   在 System.ServiceModel.ServiceHostingEnvironment.HostingManager..ctor()
   在 System.ServiceModel.ServiceHostingEnvironment.EnsureInitialized()
   在 System.ServiceModel.ServiceHostingEnvironment.OnEnsureInitialized(Object state)
   在 System.ServiceModel.PartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
   在 System.ServiceModel.ServiceHostingEnvironment.SafeEnsureInitialized()
   在 System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
   在 System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--><!--
此错误页可能包含敏感信息,因为 ASP.NET 通过 &lt;customErrors mode="Off"/&gt; 被配置为显示详细错误消息。请考虑在生产环境中使用 &lt;customErrors mode="On"/&gt; 或 &lt;customErrors mode="RemoteOnly"/&gt;。-->




配置的
<?xml version="1.0"?>
<!--
  有关如何配置 ASP.NET 应用程序的详细信息,请访问
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <customErrors mode="Off"/>
    <compilation targetFramework="4.0"/>
    <httpRuntime/>
  </system.web>
</configuration>


大神说下现在要怎么改呢?研究了半天还是不懂
发表于 2015-9-9 14:28:23 | 显示全部楼层
把你的程序贴出来,一般处理程序,完整一点,还有Httphelper的代码贴一下看看
发表于 2015-9-9 14:29:41 | 显示全部楼层
目测你这个是.net版本不对。4.0的程序,可能使用了2.0的框架在运行,直接报错,不是Httphelper的问题,是程序本身的问题,你的程序就是直接通过浏览器访问应该是是错误的。
 楼主| 发表于 2015-9-9 15:56:28 | 显示全部楼层
站长苏飞 发表于 2015-9-9 14:29
目测你这个是.net版本不对。4.0的程序,可能使用了2.0的框架在运行,直接报错,不是Httphelper的问题,是程 ...

服务器好像是支持4.0的,现在是我要把那个程序做成2.0的还是服务器的程序弄成2.0的呢

支持语言: .NET1.1/2.0/3.5/4.0/4.5、ASP、HTML、WAP
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-4-19 23:00

© 2014-2021

快速回复 返回顶部 返回列表