Web服务命名空间



我的webservice命名空间有问题。它在我的电脑上运行良好,但当我将它上传到team foundation server时,它对其他任何人都不起作用。

我在Web服务中的代码(位于其自己的应用程序中的"Sentry.SAID"命名空间中):

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports Sentry.SAID.Core
Imports Sentry.SAID.Web
<System.Web.Services.WebService(Namespace:="http://localhost")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Powerbeatws
Inherits System.Web.Services.WebService

"Sentry.SAID"命名空间中"Sentry.SAID.Web"应用程序中的XML文件

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="PowerbeatwsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="11000000" maxBufferPoolSize="524288"
maxReceivedMessageSize="11000000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:62862/Powerbeatws.asmx" binding="basicHttpBinding"
bindingConfiguration="PowerbeatwsSoap" contract="PowerbeatSR.PowerbeatwsSoap"
name="PowerbeatwsSoap" />
</client>
</system.serviceModel>

如果我将端点地址更改为localhost/Powerbeatws.asmx,则会引发错误。知道我如何使用localhost在单独的计算机上工作吗?

目前,为了让它在任何其他计算机上工作,必须添加一个新的服务引用。

对于Web服务,我们必须记住有两个实体,即托管的服务和使用它的客户端。

如果两者都要在绑定中使用localhost,则必须假设端口号相同,或者从TFS下载代码的人必须将端点绑定从localhost:62862更改为其计算机上运行服务的端口。

您也可以通过web服务上的配置或通过代码创建特定的托管地址,其中每个人都使用一个众所周知的端口,例如51000。将端点绑定更改为localhost:51000,并确保服务主机正在侦听端口51000,并且它应该可以正常工作。

我认为问题在于团队在本地主机上没有使用相同的端口号,所以绑定不起作用。它在您的计算机上工作,因为您在端口62862上托管该服务。

可能是错的。不确定他们看到的异常是什么,但在共享web服务代码时,这并不是一个常见的问题。

最新更新