Javascript 从apache服务器上的HTML调用ASPX到out JSONP时出错500

Javascript 从apache服务器上的HTML调用ASPX到out JSONP时出错500,javascript,jquery,asp.net,jsonp,vb.net-2010,Javascript,Jquery,Asp.net,Jsonp,Vb.net 2010,关于这个链接,我也在尝试做同样的事情。因此,我在apache服务器上托管的html页面(SPA)的一部分中包含以下代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <meta name="apple-mobile-web-app-capable" content=

关于这个链接,我也在尝试做同样的事情。因此,我在apache服务器上托管的html页面(SPA)的一部分中包含以下代码:

<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>MyMobilePage</title>

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

<!-- Librerie PhotoSwipe   -->
<link rel="stylesheet" type="text/css" href="../PhotoSwipe/photoswipe.css">
<link rel="stylesheet" type="text/css" href="../PhotoSwipe/styles.css">
<script type="text/javascript" src="../PhotoSwipe/klass.min.js"></script>
<script type="text/javascript" src="../PhotoSwipe/code.photoswipe-3.0.5.min.js"></script>
<!-- End PhotoSwipe   -->
第一个问题我必须在这个ASPX的HTML中写一些东西吗

这里是允许HttpResponse的IIS配置(Web.config) -我想我在里面放了太多的东西,你能告诉我我可以删除哪一个吗,我的目标是运行这个例子,但我想返回一个HTML代码,我不知道我是如何使用JSONP猜测的,但这是我的下一步,现在我想让这个例子工作

 <system.webServer>
         <httpProtocol>
                <customHeaders>
                <add name="Access-Control-Allow-Origin" value="*" />
                <add name="Access-Control-Allow-Headers" value="SOAPAction, application/json, Origin, X-Requested-With, Content-Type, Accept, Authorization" />
                <add name="Access-Control-Allow-Methods" value="POST, PUT, DELETE, GET, OPTIONS" />
        </customHeaders>
      </httpProtocol>
我收到错误消息500内部服务器错误,可能是什么,我忘记了一些配置

先谢谢你

Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Web.Script.Serialization
Imports System.Web.mvc

Public Class JsonpResult
    Inherits ActionResult
    Private ReadOnly _obj As Object

    Public Sub New(obj As Object)
        _obj = obj
    End Sub

    Public Overrides Sub ExecuteResult(context As ControllerContext)
        Dim serializer = New JavaScriptSerializer()
        Dim callbackname = context.HttpContext.Request("callback")
        Dim jsonp = String.Format("{0}({1})", callbackname, serializer.Serialize(_obj))
        Dim response = context.HttpContext.Response
        response.ContentType = "application/json"
        response.Write(jsonp)
        response.End()
    End Sub

    Public Function AddPerson(person As String) As ActionResult
        Return New JsonpResult(True)

    End Function
End Class
 <system.webServer>
         <httpProtocol>
                <customHeaders>
                <add name="Access-Control-Allow-Origin" value="*" />
                <add name="Access-Control-Allow-Headers" value="SOAPAction, application/json, Origin, X-Requested-With, Content-Type, Accept, Authorization" />
                <add name="Access-Control-Allow-Methods" value="POST, PUT, DELETE, GET, OPTIONS" />
        </customHeaders>
      </httpProtocol>
Request URL:http://publicIP:Portn/GetNames.aspx/AddPerson?callback=jQuery1910335388598497957_1387526286364&firstName=john&lastName=smith&_=1387526286365
Request Method:GET
Status Code:500 Internal Server Error
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,it;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Cookie:__utma=155182590.733648325.1387385626.1387385626.1387406760.2; __utmz=155182590.1387385626.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Host:publicIP:Portn
Referer:http://www.mywebsite.com/Test/Test.html
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Query String Parametersview sourceview URL encoded
callback:jQuery1910335388598497957_1387526286364
firstName:john
lastName:smith
_:1387526286365
Response Headersview source
Access-Control-Allow-Headers:SOAPAction, application/json, Origin, X-Requested-With, Content-Type, Accept, Authorization
Access-Control-Allow-Methods:POST, PUT, DELETE, GET, OPTIONS
Access-Control-Allow-Origin:*
Cache-Control:private
Content-Length:3420
Content-Type:text/html; charset=utf-8
Date:Fri, 20 Dec 2013 07:58:19 GMT
Server:Microsoft-IIS/8.5
X-AspNet-Version:4.0.30319
X-Powered-By:ASP.NET