Sharepoint中的自定义ASP.net Web服务

Sharepoint中的自定义ASP.net Web服务,asp.net,sharepoint,sharepoint-2010,asmx,Asp.net,Sharepoint,Sharepoint 2010,Asmx,我使用VS在sharepoint 2010中创建了一个asp.net自定义Web服务,并将其部署在sharepoint的_布局文件夹下。一切正常。现在我希望这个服务可以跨域公开,这样任何人都可以使用它或调用它。我也希望从任何非微软技术(如java等)调用它。Web服务向sharepoint列表中添加项目我已在提升权限中编写了代码。要使其对所有人或特定人员可用,还需要执行哪些操作 Now i'm trying to call same web service from console app, b

我使用VS在sharepoint 2010中创建了一个asp.net自定义Web服务,并将其部署在sharepoint的_布局文件夹下。一切正常。现在我希望这个服务可以跨域公开,这样任何人都可以使用它或调用它。我也希望从任何非微软技术(如java等)调用它。Web服务向sharepoint列表中添加项目我已在提升权限中编写了代码。要使其对所有人或特定人员可用,还需要执行哪些操作

Now i'm trying to call same web service from console app, but i'm getting error below is my code in console app

            ListServiceReference.FRListWebServiceSoapClient obj = default(ListServiceReference.FRListWebServiceSoapClient);
            obj = new ListServiceReference.FRListWebServiceSoapClient();
            obj.ClientCredentials.Windows.AllowNtlm = true;

            BasicHttpBinding binding = new BasicHttpBinding();
            // Use double the default value
            binding.MessageEncoding = WSMessageEncoding.Mtom;

obj.WebMethod(parameters);

            Console.Write("worked");
            Console.Read();



And my app config is 

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="FRListWebServiceSoap" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
                    messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="Ntlm"  />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://server name/_layouts/CustomListWebService/FRListWebService.asmx"
                binding="basicHttpBinding" bindingConfiguration="FRListWebServiceSoap"
                contract="ListServiceReference.FRListWebServiceSoap" name="FRListWebServiceSoap" />
        </client>
    </system.serviceModel>
</configuration>


I tried increasing buffer size and all but no help. i'm getting exception


System.ServiceModel.ProtocolException was unhandled
  Message=The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<html>
    <head>
        <title>The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))</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>Server Error in '/_layouts/CustomListWebService' Application.<hr width=100% si'.
  Source=mscorlib
  StackTrace:
    Server stack trace: 
       at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

What do I need to do at both end console app end and inside layout folder where webservice is deployed
Also I want it to be accessed it for cross domain for specific people in that scenario what are the changes I will require.

Thanks in advance
现在我正试图从控制台应用程序调用相同的web服务,但我发现下面的错误是我在控制台应用程序中的代码
ListServiceReference.FRListWebServiceSoapClient obj=默认值(ListServiceReference.FRListWebServiceSoapClient);
obj=新的ListServiceReference.FRListWebServiceSoapClient();
obj.ClientCredentials.Windows.AllowNtlm=true;
BasicHttpBinding=新的BasicHttpBinding();
//使用默认值的两倍
binding.MessageEncoding=WSMessageEncoding.Mtom;
对象方法(参数);
控制台。写入(“工作”);
Console.Read();
我的应用程序配置是
我尝试增加缓冲区大小,但没有任何帮助。我有个例外
System.ServiceModel.ProtocolException未处理
Message=内容类型text/html;响应消息的charset=utf-8与绑定的内容类型不匹配(multipart/related;type=“application/xop+xml”)。如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法。响应的前1024个字节是:'
句柄无效。(HRESULT的异常:0x80070006(E_句柄))
正文{字体系列:“Verdana”;字体重量:正常;字体大小:.7em;颜色:黑色;}
p{字体系列:“Verdana”;字体大小:正常;颜色:黑色;页边顶部:-5px}
{字体系列:“Verdana”;字体大小:粗体;颜色:黑色;页边顶部:-5px}
H1{字体系列:“Verdana”;字体重量:正常;字体大小:18pt;颜色:红色}
H2{字体系列:“Verdana”;字体重量:正常;字体大小:14pt;颜色:褐红色}
前{字体系列:“Lucida控制台”;字体大小:.9em}
.marker{字体大小:粗体;颜色:黑色;文本装饰:无;}
.version{color:gray;}
.错误{页边距底部:10px;}
.expandable{文本装饰:下划线;字体大小:粗体;颜色:海军蓝;光标:手;}

“/\u layouts/CustomListWebService”应用程序中出现服务器错误。您可能还需要在web应用程序上启用匿名身份验证。你尝试过这样做吗?还没有,我会尝试这样做,不管怎样,我在哪里可以提到这个web.config?你可以尝试这个帖子()来为整个web应用程序启用匿名。要允许匿名使用web配置,请选中此()项,最好在_vti_bin下部署web服务。它是其他web服务驻留的地方。感谢您的建议,现在我可以远程调用web服务,也可以使用它。现在,我希望使用https的SSL使用web服务。当我尝试这一点时,我得到了错误,比如地址无效。。。然后我将security=transport放在app config中。但问题是,在这里找不到web应用程序https:///sites/my 斯皮斯特。虽然我在app config中给出的路径是https:///_layout/web 服务名称/.asmx……….有指针吗??