小问题:怎么搭建.net下用C#开发Web Serverice的环境啊!

mysmile2 2003-03-12 05:45:41
我的操作系统是2KS,安装了IIS和Visual Stido.NET,我按书上说的新建一个ASP.NET Web Service程序,然后把"Hello World"那段代码的注释去掉,编译浏览,但是都出现一个对话框,提示是"打开"还是"保存",还是"取消",这是怎么回事?请教有经验的,谢谢啦!
...全文
126 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
solar 2003-03-20
  • 打赏
  • 举报
回复
gz
water3000 2003-03-19
  • 打赏
  • 举报
回复
在安装FrameSDK的目录中 aspnet_regiis.exe -i 就行了
veijerd 2003-03-16
  • 打赏
  • 举报
回复
对了
url栏为:
http://localhost/WebService1/Service1.asmx
veijerd 2003-03-16
  • 打赏
  • 举报
回复
我的问题更奇怪~~
是一个完好的页面:


The following operations are supported. For a formal definition, please review the Service Description.


--------------------------------------------------------------------------------

This web service is using http://tempuri.org/ as its default namespace.
Recommendation: Change the default namespace before the XML Web service is made public.
Each XML Web service needs a unique namespace in order for client applications to distinguish it from other services on the Web. http://tempuri.org/ is available for XML Web services that are under development, but published XML Web services should use a more permanent namespace.

Your XML Web service should be identified by a namespace that you control. For example, you can use your company's Internet domain name as part of the namespace. Although many XML Web service namespaces look like URLs, they need not point to actual resources on the Web. (XML Web service namespaces are URIs.)

For XML Web services creating using ASP.NET, the default namespace can be changed using the WebService attribute's Namespace property. The WebService attribute is an attribute applied to the class that contains the XML Web service methods. Below is a code example that sets the namespace to "http://microsoft.com/webservices/":

C#

[WebService(Namespace="http://microsoft.com/webservices/")]
public class MyWebService {
// implementation
}
Visual Basic.NET

<WebService(Namespace:="http://microsoft.com/webservices/")> Public Class MyWebService
' implementation
End Class
For more details on XML namespaces, see the W3C recommendation on Namespaces in XML.

For more details on WSDL, see the WSDL Specification.

For more details on URIs, see RFC 2396.


这是怎么回事啊?
mysmile2 2003-03-15
  • 打赏
  • 举报
回复
楼上说的很有道理,不过我的IE已经升级到6.0了。
我.asmx的代码如下,应该没有问题吧!

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;

namespace WebService1
{
/// <summary>
/// Service1 的摘要说明。
/// </summary>
public class WebService1 : System.Web.Services.WebService
{
public WebService1()
{
//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";
}
}
}
yqdeng 2003-03-15
  • 打赏
  • 举报
回复
估计是浏览器对asmx无法解析,升级IE或重装.net Framework试试
shuguang 2003-03-14
  • 打赏
  • 举报
回复
按照默认的设置是没有问题的,只需要把注释删掉,按 Ctrl+F5就能看到结果。
onlinebingo 2003-03-14
  • 打赏
  • 举报
回复
把你生成的.asmx代码贴出来让大家看看吧
turui 2003-03-13
  • 打赏
  • 举报
回复
c#下新建项目向导,有个ASP.NET web服务,按照向导做下去里面自动生成了一个hello word 很简单的
mysmile2 2003-03-13
  • 打赏
  • 举报
回复
还是不对啊,我浏览的时候出现的一行代码,如下:<%@ WebService Language="c#" Codebehind="WebService1.asmx.cs" Class="WebService1.WebService1" %>
其他什么也没有了,这不对吧?
孟子E章 2003-03-12
  • 打赏
  • 举报
回复
http://www.ccw.com.cn/htm/center/prog/02_8_26_2.asp

12,165

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧