C# 使用jquery在asp.net mvc中跨域调用wcf

C# 使用jquery在asp.net mvc中跨域调用wcf,c#,jquery,asp.net,asp.net-mvc,wcf,C#,Jquery,Asp.net,Asp.net Mvc,Wcf,我在asp.net mvc中创建了具有代理名称的项目,并使用LoginServices for wcf服务在同一解决方案中创建了其他项目,现在我想用jquery调用wcf方法,但我得到了错误 我的界面 [ServiceContract] public interface ILoginServices { [OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyl

我在asp.net mvc中创建了具有代理名称的项目,并使用LoginServices for wcf服务在同一解决方案中创建了其他项目,现在我想用jquery调用wcf方法,但我得到了错误

我的界面

    [ServiceContract]
    public interface ILoginServices
    {

    [OperationContract]
    [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
    string HelloWorld(string personName);

}
我的服务.svc

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

public class LoginServices : ILoginServices
{


    public string HelloWorld(string personName)
    {
        JavaScriptSerializer serializer = new JavaScriptSerializer();

        // you are not returning data in proper JSON format, wrap the text in
        // an anonymous object before serializing.
        return serializer.Serialize(new { text = "Hello " + personName });
    }

}
我的登录服务web.config

<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true" />
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="" helpEnabled="true"
          automaticFormatSelectionEnabled="true" />
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <appSettings>
    <add key="address" value="localhost"/>
    <add key="pascaladdress" value="localhost"/>
    <add key="sms" value="0" />
  </appSettings>

</configuration>
但是我得到了这个错误

400 Bad Request
在chrome中,我的请求URL是

http://localhost:18169/LoginServices.svc/HelloWorld?callback=jQuery110206046013286612855_1465972517580&{%22personName%22:%22John%22}&_=1465972517581
如何用我的代码实现跨域ajax

谢谢你的帮助

http://localhost:18169/LoginServices.svc/HelloWorld?callback=jQuery110206046013286612855_1465972517580&{%22personName%22:%22John%22}&_=1465972517581