2012-10-12 117 views
1

我的web服務名稱空間出現問題。它在我的電腦上工作正常,但是當我將它上傳到團隊基礎服務器時,它不適用於其他人。Web服務名稱空間

我在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 

XML文件中的「Sentry.SAID.Web」應用程序中的「Sentry.SAID」命名空間

 <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,它拋出一個錯誤。任何想法就是我能得到這個使用本地主機上單獨的電腦嗎?

目前到g如果要在任何其他計算機上工作,則必須添加新的服務參考。

+0

假設他們正在他們的本地計算機上運行端口62862上的服務,它應該工作,我會認爲......也許他們的服務端口號代管服務是不同的? – Pepto

+0

每臺機器的服務端口號都會更改。 –

+0

命名空間中的「http:// localhost」與配置文件中的「http:// localhost:62862」無關。他們完全不相關。 –

回答

0

對於Web服務,我們必須記住有兩個實體參與,即服務託管和客戶端使用它。

如果兩者都在綁定中使用localhost,則它們必須採用相同的端口號,或者從TFS下載代碼的人必須將端點綁定從localhost:62862更改爲服務在其計算機上運行的任何端口。

您也可以通過在Web服務上進行配置或通過所有人都使用衆所周知的端口的代碼來創建特定的託管地址。 51000.將端點綁定更改爲localhost:51000,並確保服務主機正在偵聽端口51000,並且應該可以正常工作。

我認爲問題是團隊沒有在他們的本地主機上使用相同的端口號,所以綁定不起作用。它適用於您的機器,因爲您正在端口62862上託管服務。

雖然可能是錯誤的。不確定他們看到了什麼異常,但這在共享Web服務代碼時並不罕見。

相關問題