WebService创建、发布及在IIS上部署

WebService创建、发布及在IIS上部署

https://blog.csdn.net/u011534341/article/details/44925473

让WebService支持HTTPGET

https://blog.csdn.net/ss_tt_ll/article/details/81300119

在WebService工程的Web.config文件中<system.web>节的最后增加以下内容

<webServices>
            <protocols>
                <add name="HttpSoap1.2"/>
                <add name="HttpSoap"/>
                <add name="HttpPost"/>
                <add name="HttpGet"/>
                <add name="HttpPostLocalhost"/>
                <add name="Documentation"/>
            </protocols>
        </webServices>

可以参考/Microsoft.NET/Framework/{version}/CONFIG/machine.config里面的<webServices>一节的内容

由于HttpGet这里被屏蔽掉了,因此在web.config里面要放开才行,

至于HttpPost也是屏蔽状态,估计默认在WebService里面是允许的吧。

        <webServices>
            <protocols>
                <add name="HttpSoap1.2"/>
                <add name="HttpSoap"/>
                <!-- <add name="HttpPost"/> -->
                <!-- <add name="HttpGet"/> -->
                <add name="HttpPostLocalhost"/>
                <add name="Documentation"/>
            </protocols>
            <soapExtensionTypes>
            </soapExtensionTypes>
            <soapExtensionReflectorTypes>
            </soapExtensionReflectorTypes>
            <soapExtensionImporterTypes>
            </soapExtensionImporterTypes>
            <wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx"/>
            <serviceDescriptionFormatExtensionTypes>
            </serviceDescriptionFormatExtensionTypes>
        </webServices>
 

Webservice返回json数据格式

https://www.cnblogs.com/xinweichen/p/4552187.html

改变数据的返回方式,用 Context.Response.Write代替return 语句

<span >   

 [WebMethod]  

   public void GetQrCodeList(String qrCode)  

  {  

      Context.Response.Charset = "GB2312"; //设置字符集类型  

        Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");  

       Context.Response.Write(PriGetQrCodeList(qrCode));  

       Context.Response.End();  

    }</span>  

猜你喜欢

转载自blog.csdn.net/huluanchushou/article/details/86235196