<%@ WebService Language="c#" Codebehind="Service1.asmx.cs" Class="WebApplication5.Service1" %>

解决方案 »

  1.   

    有没有完整的asmx.cs的代码例子我看看
      

  2.   

    有没有完整的asmx.cs的代码例子能贴给我看看,msdn中例子的都是片段没有完整
      

  3.   

    .Net FrameWork QuickStart有很好的,完整的例子。
    orhttp://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/services/DataTypes/DataTypes.src
      

  4.   

    我要net中的asmx代码窗体中的哪种<%@ Webservice Language="C#" class="DailyHoro" %> 是如何写的
      

  5.   

    感谢您使用微软产品。您可以通过Visual Studio .net IDE提供的Templates-ASP.NET Web Service,就可以生成完整的Service1.asmx和Service1.asmx.cs代码:
    下面提供一段示例代码供您参考:
    Service1.asmx代码:
    <%@ WebService Language="c#" Codebehind="Service1.asmx.cs" Class="WebService1.Service1" %>Service1.asmx.cs代码:
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Web;
    using System.Web.Services;namespace WebService1
    {
    /// <summary>
    /// Summary description for Service1.
    /// </summary>
    public class Service1 : System.Web.Services.WebService
    {
    public Service1()
    {
    //CODEGEN: This call is required by the ASP.NET Web Services Designer
    InitializeComponent();
    } #region Component Designer generated code

    //Required by the Web Services Designer 
    private IContainer components = null;

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    } /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if(disposing && components != null)
    {
    components.Dispose();
    }
    base.Dispose(disposing);
    }

    #endregion // WEB SERVICE EXAMPLE
    // The HelloWorld() example service returns the string Hello World
    // To build, uncomment the following lines then save and build the project
    // To test this web service, press F5 [WebMethod]
    public string HelloWorld()
    {
    return "Hello World";
    }
    }
    } — 微软全球技术中心 VB支持中心本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
    为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。