在IIS6上部署WebService
生活随笔
收集整理的這篇文章主要介紹了
在IIS6上部署WebService
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在IIS6上部署WebService
2016-12-07
目錄:
1 創建web service項目
2 部署WebService
3 瀏覽頁面
1 創建web service項目
?返回?
用Visual Studio模板“ASP.NET Web 服務應用程序”新建項目。
其它不變,只增加WebMethod Add方法,如下圖1所示?
圖1 創建Web Service項目
把WebService1.dll放在目錄D:\Study\WebSerice\bin下,把Service1.asmx和Web.config放在目錄D:\Study\WebSerice下,代碼如下:
Service1.asmx.cs代碼:
using System.Web.Services;namespace WebService1 {/// <summary>/// Service1 的摘要說明/// </summary>[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.ComponentModel.ToolboxItem(false)]public class Service1 : System.Web.Services.WebService{[WebMethod]public float Add(float a,float b){return a + b;}} }Service1.asmx代碼:
<%@ WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="WebService1.Service1" %>Web.config代碼:
<?xml version="1.0" encoding="utf-8"?> <configuration><appSettings/><connectionStrings/><system.web><compilation debug="true" ></compilation><!--通過 <authentication> 節,可配置 ASP.NET 用于識別進入用戶的 安全身份驗證模式。--><authentication mode="Windows" /><!--通過 <customErrors> 節,可以配置在執行請求的過程中出現未處理的錯誤時要執行 的操作。具體而言,開發人員通過該節可配置要顯示的 html 錯誤頁,以代替錯誤堆棧跟蹤。<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"><error statusCode="403" redirect="NoAccess.htm" /><error statusCode="404" redirect="FileNotFound.htm" /></customErrors>--></system.web></configuration>2 部署WebService
?返回
部署跟 在IIS6上部署aspx網站中的部署一致
3 瀏覽頁面
?返回
進入Add頁面,輸入參數后可以調用add方法
?
轉載于:https://www.cnblogs.com/Ming8006/p/6140008.html
總結
以上是生活随笔為你收集整理的在IIS6上部署WebService的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Java集合系列】---ArrayLi
- 下一篇: [20161208]等待事件enq: H