奇怪,我试试用默认的名称空间没有发现你说的问题~~~Imports System.Web.Services<WebService(Namespace:="http://tempuri.org/")> _ Public Class HelloWorld Inherits System.Web.Services.WebService#Region " Web 服务设计器生成的代码 " Public Sub New() MyBase.New() '该调用是 Web 服务设计器所必需的。 InitializeComponent() '在 InitializeComponent() 调用之后添加您自己的初始化代码 End Sub 'Web 服务设计器所必需的 Private components As System.ComponentModel.IContainer '注意:以下过程是 Web 服务设计器所必需的 '可以使用 Web 服务设计器修改此过程。 '不要使用代码编辑器修改它。 <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() components = New System.ComponentModel.Container() End Sub Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) 'CODEGEN: 此过程是 Web 服务设计器所必需的 '不要使用代码编辑器修改它。 If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub#End Region ' Web 服务示例 ' HelloWorld() 示例服务返回字符串 Hello World。 ' 若要生成项目,请取消注释以下行,然后保存并生成项目。 ' 若要测试此 Web 服务,请确保 .asmx 文件为起始页 ' 并按 F5 键。 ' <WebMethod()> Public Function HelloWorld() As String HelloWorld = "Hello World" End FunctionEnd Class
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services;namespace VideoServer { /// <summary> /// Service1 的摘要说明。 /// </summary> /// [WebService(Namespace="/VideoServer")] public class Service1 : System.Web.Services.WebService { public Service1() { //CODEGEN:该调用是 ASP.NET Web 服务设计器所必需的 InitializeComponent(); } #region Component Designer generated code
mode="RemoteOnly"
defaultRedirect="http://www.sina.com.cn" />
/> 在哪里设false?
mode="False"
defaultRedirect="http://www.sina.com.cn" />
/>
建议:在使 XML Web service 公开之前,请更改默认命名空间。
返回:
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org/">Hello World</string>
Public Class HelloWorld
Inherits System.Web.Services.WebService#Region " Web 服务设计器生成的代码 " Public Sub New()
MyBase.New() '该调用是 Web 服务设计器所必需的。
InitializeComponent() '在 InitializeComponent() 调用之后添加您自己的初始化代码 End Sub 'Web 服务设计器所必需的
Private components As System.ComponentModel.IContainer '注意:以下过程是 Web 服务设计器所必需的
'可以使用 Web 服务设计器修改此过程。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: 此过程是 Web 服务设计器所必需的
'不要使用代码编辑器修改它。
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub#End Region ' Web 服务示例
' HelloWorld() 示例服务返回字符串 Hello World。
' 若要生成项目,请取消注释以下行,然后保存并生成项目。
' 若要测试此 Web 服务,请确保 .asmx 文件为起始页
' 并按 F5 键。
'
<WebMethod()> Public Function HelloWorld() As String
HelloWorld = "Hello World"
End FunctionEnd Class
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;namespace VideoServer
{
/// <summary>
/// Service1 的摘要说明。
/// </summary>
///
[WebService(Namespace="/VideoServer")]
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
//CODEGEN:该调用是 ASP.NET Web 服务设计器所必需的
InitializeComponent();
} #region Component Designer generated code
//Web 服务设计器所必需的
private IContainer components = null;
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion // WEB 服务示例
// HelloWorld() 示例服务返回字符串 Hello World
// 若要生成,请取消注释下列行,然后保存并生成项目
// 若要测试此 Web 服务,请按 F5 键 [WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public string GetList()
{
return "cbc.xml";
} }
}