如何在IIS中配置WebService
刚刚开始做Asp.net,老板说用WebService的,我看了下,好像是将业务逻辑写在Service中,然后再建aspx网站,在其中调用WebSerivce的功能,将业务和技术分开,不知道这样理解对不对。我做了个简单的功能,在WebSite中做了Web reference,引用了WebService,并Publish了WebSite,然后装了IIS,我用的是Vista系统,装的好像是IIS7,然后建立虚拟目录,将发布的WebSite放到目录下,将虚拟路径指向该目录。现在问题是:在有IIS的情况下,可以打开该网站页面,等我将form输入并提交form,需要WebService的某方法来处理时,页面报错,
Server Error in '/MySampleService' Application.
No connection could be made because the target machine actively refused it 127.0.0.1:4840
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:4840
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:4840]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +1073657
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +217
[WebException: Unable to connect to the remote server]
System.Net.HttpWebRequest.GetRequestStream() +1534317
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +103
localhost.CustomerServices.AddValues(Int32 v1, Int32 v2) +95
_Default.btnSubmit_Click(Object sender, EventArgs e) +216
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
但如果我不关闭Vs。net2005中Webservice的Asp.net development server,则可以完成这个功能,意思就是说,我配置的IIS可以访问asp页面,但没有处理好IIS对WebService的设置,怎么配置才正确? --------------------编程问答-------------------- 127.0.0.1:4840 端口不可用吧 你直接浏览你的WebService服务页(*.asmx) 如果不能访问就是IIS的问题了
你给IIS指定IP了吗 指定了就去掉
再或者把你引用的WebService下的cs类文件贴出来看看 --------------------编程问答-------------------- 和配置网站没什么区别 --------------------编程问答-------------------- 解决了,在vs.net中可以打开webservice属性设置是用aps development server或者用IIS来发布该service,谢谢。
补充:.NET技术 , ASP.NET