C#建立WebService就不多说了,百度一下。
本例的服务是接收发来的文字信息保存,并发送给用户。
WinForm发送文字信息,并每2秒刷新从服务取得的文字信息。
1、配置好IIS,指向TentWebService.asmx文件夹和文件,百度IIS配置;
2、编写修改完TentWebService.asmx,点右键“发布”;
3、WinForm里点右键选择“添加”、“服务引用”,指向IIS的地址,点击“转到”,再输入“命名空间”。

资源文件列表
Test_WinForm测试/test/.vs/test/v14/.suo , 44544
Test_WinForm测试/test/App.config , 687
Test_WinForm测试/test/bin/Debug/test.exe , 13312
Test_WinForm测试/test/bin/Debug/test.exe.config , 687
Test_WinForm测试/test/bin/Debug/test.pdb , 34304
Test_WinForm测试/test/bin/Debug/test.vshost.exe , 22696
Test_WinForm测试/test/bin/Debug/test.vshost.exe.config , 687
Test_WinForm测试/test/bin/Debug/test.vshost.exe.manifest , 490
Test_WinForm测试/test/CrossThreadCall.cs , 516
Test_WinForm测试/test/Form1.cs , 1865
Test_WinForm测试/test/Form1.Designer.cs , 3532
Test_WinForm测试/test/Form1.resx , 5817
Test_WinForm测试/test/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache , 7972
Test_WinForm测试/test/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs , 0
Test_WinForm测试/test/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs , 0
Test_WinForm测试/test/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs , 0
Test_WinForm测试/test/obj/Debug/TempPE/Service References.call_server.Reference.cs.dll , 5632
Test_WinForm测试/test/obj/Debug/TempPE/Service References.Call_Serveric.Reference.cs.dll , 6656
Test_WinForm测试/test/obj/Debug/TempPE/Service References.Call_Service.Reference.cs.dll , 6656
Test_WinForm测试/test/obj/Debug/test.csproj.FileListAbsolute.txt , 432
Test_WinForm测试/test/obj/Debug/test.csproj.GenerateResource.Cache , 1012
Test_WinForm测试/test/obj/Debug/test.exe , 13312
Test_WinForm测试/test/obj/Debug/test.Form1.resources , 180
Test_WinForm测试/test/obj/Debug/test.pdb , 34304
Test_WinForm测试/test/obj/Debug/test.Properties.Resources.resources , 180
Test_WinForm测试/test/Program.cs , 516
Test_WinForm测试/test/Properties/AssemblyInfo.cs , 1316
Test_WinForm测试/test/Properties/Resources.Designer.cs , 2821
Test_WinForm测试/test/Properties/Resources.resx , 5612
Test_WinForm测试/test/Properties/Settings.Designer.cs , 1091
Test_WinForm测试/test/Properties/Settings.settings , 249
Test_WinForm测试/test/Service References/Call_Service/configuration.svcinfo , 1425
Test_WinForm测试/test/Service References/Call_Service/configuration91.svcinfo , 19744
Test_WinForm测试/test/Service References/Call_Service/Reference.cs , 12070
Test_WinForm测试/test/Service References/Call_Service/Reference.svcmap , 1819
Test_WinForm测试/test/Service References/Call_Service/TentWebService.disco , 705
Test_WinForm测试/test/Service References/Call_Service/TentWebService.wsdl , 4327
Test_WinForm测试/test/Service References/Call_Service/test.Call_Service.Send_MessageResponse.datasource , 656
Test_WinForm测试/test/Service References/Call_Service/test.Call_Service.Total_MessageResponse.datasource , 658
Test_WinForm测试/test/test.csproj , 5417
Test_WinForm测试/test/test.sln , 974
WEB_Service/.vs/config/applicationhost.config , 86463
WEB_Service/.vs/hy_bbs/v14/.suo , 50176
WEB_Service/.vs/TentServeric/v14/.suo , 72704
WEB_Service/bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll , 29344
WEB_Service/bin/roslyn/csc.exe , 41608
WEB_Service/bin/roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll , 85192
WEB_Service/bin/roslyn/Microsoft.CodeAnalysis.CSharp.dll , 4000448
WEB_Service/bin/roslyn/Microsoft.CodeAnalysis.dll , 1724080
WEB_Service/bin/roslyn/Microsoft.CodeAnalysis.VisualBasic.dll , 4901064
WEB_Service/bin/roslyn/Microsoft.CSharp.Core.targets , 6416
WEB_Service/bin/roslyn/Microsoft.VisualBasic.Core.targets , 5846
WEB_Service/bin/roslyn/System.Collections.Immutable.dll , 204544
WEB_Service/bin/roslyn/System.Reflection.Metadata.dll , 262896
WEB_Service/bin/roslyn/vbc.exe , 41608
WEB_Service/bin/roslyn/VBCSCompiler.exe , 63648
WEB_Service/bin/roslyn/VBCSCompiler.exe.config , 563
WEB_Service/bin/TentServeric.dll , 4608
WEB_Service/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/build/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props , 324
WEB_Service/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/content/web.config.install.xdt , 2131
WEB_Service/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/content/web.config.uninstall.xdt , 742
WEB_Service/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/lib/net45/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll , 29344
WEB_Service/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/lib/net45/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml , 1805
WEB_Service/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0.nupkg , 34052
WEB_Service/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/tools/init.ps1 , 11546
WEB_Service/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0/tools/uninstall.ps1 , 10146
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/build/Microsoft.Net.Compilers.props , 2333
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/Microsoft.Net.Compilers.1.0.0.nupkg , 4362088
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/ThirdPartyNotices.rtf , 10365
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/csc.exe , 41608
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/Microsoft.Build.Tasks.CodeAnalysis.dll , 85192
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/Microsoft.CodeAnalysis.CSharp.dll , 4000448
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/Microsoft.CodeAnalysis.dll , 1724080
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/Microsoft.CodeAnalysis.VisualBasic.dll , 4901064
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/Microsoft.CSharp.Core.targets , 6416
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/Microsoft.VisualBasic.Core.targets , 5846
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/System.Collections.Immutable.dll , 204544
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/System.Reflection.Metadata.dll , 262896
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/vbc.exe , 41608
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/VBCSCompiler.exe , 63648
WEB_Service/packages/Microsoft.Net.Compilers.1.0.0/tools/VBCSCompiler.exe.config , 563
WEB_Service/packages.config , 292
WEB_Service/TentServeric/bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll , 29344
WEB_Service/TentServeric/bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml , 1805
WEB_Service/TentServeric/bin/roslyn/csc.exe , 41608
WEB_Service/TentServeric/bin/roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll , 85192
WEB_Service/TentServeric/bin/roslyn/Microsoft.CodeAnalysis.CSharp.dll , 4000448
WEB_Service/TentServeric/bin/roslyn/Microsoft.CodeAnalysis.dll , 1724080
WEB_Service/TentServeric/bin/roslyn/Microsoft.CodeAnalysis.VisualBasic.dll , 4901064
WEB_Service/TentServeric/bin/roslyn/Microsoft.CSharp.Core.targets , 6416
WEB_Service/TentServeric/bin/roslyn/Microsoft.VisualBasic.Core.targets , 5846
WEB_Service/TentServeric/bin/roslyn/System.Collections.Immutable.dll , 204544
WEB_Service/TentServeric/bin/roslyn/System.Reflection.Metadata.dll , 262896
WEB_Service/TentServeric/bin/roslyn/vbc.exe , 41608
WEB_Service/TentServeric/bin/roslyn/VBCSCompiler.exe , 63648
WEB_Service/TentServeric/bin/roslyn/VBCSCompiler.exe.config , 563
WEB_Service/TentServeric/bin/TentServeric.dll , 4608
WEB_Service/TentServeric/bin/TentServeric.dll.config , 1161
WEB_Service/TentServeric/bin/TentServeric.pdb , 13824
WEB_Service/TentServeric/Msglist.cs , 240
WEB_Service/TentServeric/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache , 9208
WEB_Service/TentServeric/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs , 0
WEB_Service/TentServeric/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs , 0
WEB_Service/TentServeric/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs , 0
WEB_Service/TentServeric/obj/Debug/TentServeric.csproj.FileListAbsolute.txt , 1174
WEB_Service/TentServeric/obj/Debug/TentServeric.dll , 4608
WEB_Service/TentServeric/obj/Debug/TentServeric.pdb , 13824
WEB_Service/TentServeric/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache , 9210
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll , 29344
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/csc.exe , 41608
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll , 85192
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/Microsoft.CodeAnalysis.CSharp.dll , 4000448
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/Microsoft.CodeAnalysis.dll , 1724080
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/Microsoft.CodeAnalysis.VisualBasic.dll , 4901064
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/Microsoft.CSharp.Core.targets , 6416
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/Microsoft.VisualBasic.Core.targets , 5846
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/System.Collections.Immutable.dll , 204544
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/System.Reflection.Metadata.dll , 262896
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/vbc.exe , 41608
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/VBCSCompiler.exe , 63648
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/roslyn/VBCSCompiler.exe.config , 563
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/bin/TentServeric.dll , 4608
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/packages.config , 292
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/TentWebService.asmx , 108
WEB_Service/TentServeric/obj/Release/Package/PackageTmp/Web.config , 1176
WEB_Service/TentServeric/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs , 0
WEB_Service/TentServeric/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs , 0
WEB_Service/TentServeric/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs , 0
WEB_Service/TentServeric/obj/Release/TentServeric.csproj.FileListAbsolute.txt , 1178
WEB_Service/TentServeric/obj/Release/TentServeric.dll , 4608
WEB_Service/TentServeric/obj/Release/TentServeric.pdb , 13824
WEB_Service/TentServeric/obj/Release/TransformWebConfig/assist/Web.config , 1306
WEB_Service/TentServeric/obj/Release/TransformWebConfig/original/Web.config , 1161
WEB_Service/TentServeric/obj/Release/TransformWebConfig/transformed/Web.config , 1176
WEB_Service/TentServeric/obj/Release/_WPPLastBuildInfo.txt , 426
WEB_Service/TentServeric/packages.config , 292
WEB_Service/TentServeric/Properties/AssemblyInfo.cs , 1317
WEB_Service/TentServeric/Properties/PublishProfiles/Test.pubxml , 836
WEB_Service/TentServeric/Properties/PublishProfiles/Test.pubxml.user , 2660
WEB_Service/TentServeric/TentServeric.csproj , 7187
WEB_Service/TentServeric/TentServeric.csproj.user , 1237
WEB_Service/TentServeric/TentWebService.asmx , 108
WEB_Service/TentServeric/TentWebService.asmx.cs , 976
WEB_Service/TentServeric/Web.config , 1161
WEB_Service/TentServeric/Web.Debug.config , 1245
WEB_Service/TentServeric/Web.Release.config , 1306
WEB_Service/TentServeric.sln , 1003
WEB_Service/TentWebService.asmx , 108
WEB_Service/Web.config , 1373
