資源簡介
C#建立WebService就不多說了,百度一下。
本例的服務是接收發來的文字信息保存,并發送給用戶。
WinForm發送文字信息,并每2秒刷新從服務取得的文字信息。
1、配置好IIS,指向TentWebService.asmx文件夾和文件,百度IIS配置;
2、編寫修改完TentWebService.asmx,點右鍵“發布”;
3、WinForm里點右鍵選擇“添加”、“服務引用”,指向IIS的地址,點擊“轉到”,再輸入“命名空間”。
本例的服務是接收發來的文字信息保存,并發送給用戶。
WinForm發送文字信息,并每2秒刷新從服務取得的文字信息。
1、配置好IIS,指向TentWebService.asmx文件夾和文件,百度IIS配置;
2、編寫修改完TentWebService.asmx,點右鍵“發布”;
3、WinForm里點右鍵選擇“添加”、“服務引用”,指向IIS的地址,點擊“轉到”,再輸入“命名空間”。
WEB部分
namespace TentServeric
{
/// <summary>
/// TentWebService 的摘要說明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允許使用 ASP.NET AJAX 從腳本中調用此 Web 服務,請取消注釋以下行。
// [System.Web.Script.Services.ScriptService]
public class TentWebService : System.Web.Services.WebService
{
[WebMethod]
public void Total_Message (string message)
{
Msglist.msg = "{$}" message;
}
[WebMethod]
public string Send_Message ()
{
string send = Msglist.msg;
return send;
}
}
}
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Threading;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?test
{
????public?static?class?CrossThreadCall
????{
????????public?static?void?CrossThreadCalls(this?Control?ctl?ThreadStart?del)
????????{
????????????if?(del?==?null)?return;
????????????if?(ctl.InvokeRequired)
????????????????ctl.Invoke(del?null);
????????????else
????????????????del();
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????44544??2017-09-23?23:52??Test_WinForm測試\test\.vs\test\v14\.suo
?????文件????????687??2017-09-23?23:44??Test_WinForm測試\test\App.config
?????文件??????13312??2017-09-23?23:50??Test_WinForm測試\test\bin\Debug\test.exe
?????文件????????687??2017-09-23?23:44??Test_WinForm測試\test\bin\Debug\test.exe.config
?????文件??????34304??2017-09-23?23:50??Test_WinForm測試\test\bin\Debug\test.pdb
?????文件??????22696??2017-09-24?00:02??Test_WinForm測試\test\bin\Debug\test.vshost.exe
?????文件????????687??2017-09-23?23:44??Test_WinForm測試\test\bin\Debug\test.vshost.exe.config
?????文件????????490??2017-03-19?05:00??Test_WinForm測試\test\bin\Debug\test.vshost.exe.manifest
?????文件????????516??2017-09-23?23:25??Test_WinForm測試\test\CrossThreadCall.cs
?????文件???????1865??2017-09-23?23:50??Test_WinForm測試\test\Form1.cs
?????文件???????3532??2017-09-23?23:50??Test_WinForm測試\test\Form1.Designer.cs
?????文件???????5817??2017-09-23?23:50??Test_WinForm測試\test\Form1.resx
?????文件???????7972??2017-09-23?23:44??Test_WinForm測試\test\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2017-09-23?21:08??Test_WinForm測試\test\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2017-09-23?21:08??Test_WinForm測試\test\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2017-09-23?21:08??Test_WinForm測試\test\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件???????5632??2017-09-23?21:54??Test_WinForm測試\test\obj\Debug\TempPE\Service?References.call_server.Reference.cs.dll
?????文件???????6656??2017-09-23?23:12??Test_WinForm測試\test\obj\Debug\TempPE\Service?References.Call_Serveric.Reference.cs.dll
?????文件???????6656??2017-09-23?23:44??Test_WinForm測試\test\obj\Debug\TempPE\Service?References.Call_Service.Reference.cs.dll
?????文件????????432??2017-09-24?00:02??Test_WinForm測試\test\obj\Debug\test.csproj.FileListAbsolute.txt
?????文件???????1012??2017-09-23?23:50??Test_WinForm測試\test\obj\Debug\test.csproj.GenerateResource.Cache
?????文件??????13312??2017-09-23?23:50??Test_WinForm測試\test\obj\Debug\test.exe
?????文件????????180??2017-09-23?23:50??Test_WinForm測試\test\obj\Debug\test.Form1.resources
?????文件??????34304??2017-09-23?23:50??Test_WinForm測試\test\obj\Debug\test.pdb
?????文件????????180??2017-09-23?23:50??Test_WinForm測試\test\obj\Debug\test.Properties.Resources.resources
?????文件????????516??2017-09-23?21:08??Test_WinForm測試\test\Program.cs
?????文件???????1316??2017-09-23?21:08??Test_WinForm測試\test\Properties\AssemblyInfo.cs
?????文件???????2821??2017-09-23?21:08??Test_WinForm測試\test\Properties\Resources.Designer.cs
?????文件???????5612??2017-09-23?21:08??Test_WinForm測試\test\Properties\Resources.resx
?????文件???????1091??2017-09-23?21:08??Test_WinForm測試\test\Properties\Settings.Designer.cs
............此處省略175個文件信息
評論
共有 條評論
相關資源
- c#入門經典 第七版 中文版 非掃描版
- .netc#新手菜鳥mvc5的倉庫管理系統 so
- C# NPOI生成word插入圖片和表格
- C#程序設計基礎C#程序設計及應用教程
- 深入.NET平臺和C#編程
- .net 美萍超市管理系統源碼C#
- WinForm GeckoFx33 Demo JS與C#互交 窗口瀏覽
- 《ASP.NET程序設計項目教程》周虎,王
- 計算機圖形學 三維模型處理算法初步
- C# KTV 點歌系統,C#項目源碼帶數據庫
- C#實驗--A.1 視頻動態繪制練習.
- c#實現動態規劃法——求解矩陣連乘問
- c#winform中完美代替WebBrowser最新的控件
- C#高級編程第9版:C#5.0 & .NET 4.5.1 par
- Illustrated C# 2010 C# 4.0圖解教程
- C# WINFORM框架源碼
- C# WinForm實踐開發教程清晰版
- 3D打印機上位機源碼Reprap Host 是C#寫的
- C#設計模式+源碼JamesW.Cooper.zip
- C#程序開發范例寶典(第3版).(配套
- C#寫的年會抽獎軟件包含源代碼.zip
- 大型ERP C#源碼
- asp.net完整項目帶數據庫
- 一種開源業務系統框架winform源碼
- 清大出版社 段德亮 《C#課程設計案例
- C#人事管理系統/人力資源管理系統
- C# 7 and .NET Core: Modern Cross-Platform Deve
- C# 5.0 in a Nutshell 5th Edition.pdf
-
C# 6.0 and the .NET 4.6 fr
amework(7th). - C# .NET webservices簡單使用