BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / dot-net / #2578同步于 2010/12/14
该镜像源已超过 30 天没有更新,可能在源站已被删除。
dotNET机器人发帖

怎么访问局域网内的web services?

youjun
2010/12/14镜像同步5 回复
在本机用vs2005建了个用于简单四则运算的web service,用地址 http://localhost:1678/Service1.asmx可以访问,并且可以实现计算的功能,然后我想实现局域网内另一台机器对这个服务的访问。 1、在IIS默认网站下新建虚拟目录(WSApp08),将该工程的文件夹地址填入,并在属性界面将ASP。NET的版本号选为1.1.4322,勾选目录浏览选项。 2、在一个虚拟机(XP)中访问该服务(这个过程保持Web服务运行状态):输入地址http://192.168.1.6/WSApp08可以打开工程文件夹,在文件夹里可以看到Service1.asmx这个文件,点击打开这个文件的时候问题就出现了,以下是问题描述:Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off". <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration> Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL. <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration> 这是什么原因呢?是服务的问题还是连接的问题?
订阅后,新回复会通过你的通知中心匿名送达。
5 条回复
ahomer机器人#1 · 2010/12/14
http://192.168.1.6/WSApp08/Service1.asmx 这样能访问吧? 为什么ASP.NET 设置成1.1 也太古老了吧
youjun机器人#2 · 2010/12/14
我改成2.0之后还是不能访问,http://192.168.1.6/WSApp08打开工程文件夹之后再点击Service1.asmx 这个文件不就是等于直接访问http://192.168.1.6/WSApp08/Service1.asmx 么?网页有错误提示:IIS 中没有将虚拟目录配置为应用程序这是什么意思呢?
ahomer机器人#3 · 2010/12/14
应该是IIS配置的问题, 删除 虚拟目录,重新设置一遍吧
wangjianzhou机器人#4 · 2010/12/14
讲<customErrors mode="Off"/> 这个关闭的,打开后会给你具体错误,再调试,确保无误后将其关闭
youjun机器人#5 · 2010/12/15
确实有错误提示:IIS 中没有将虚拟目录配置为应用程序。 删掉原来的虚拟目录,重新设置了一个,把。net版本改为2.0之后在另一台机器上可以访问Service1.asmx这个文件了,其结果是是列出了该服务所有的方法,但是方法不能使用,提示信息:测试窗体只能用于来自本地计算机的请求。找到了解决方案:在web.config文件中加入<webServices> <protocols> <add name="HttpSoap"/> <add name="HttpPost"/> <add name="HttpGet"/> <add name="Documentation"/> </protocols> </webServices> 这样就可以打开不同的方法使用界面,可以输入参数。这时问题又出现了:输入完参数之后点击调用,返回的网页提示:找不到网页。这时为什么呢?