2008-10-15 118 views
1

在我的Visual Studio Web应用程序项目中,我添加了对Web服务的引用。当我添加一个Web引用时,会生成以下文件列表。部署时间Web服务位置

  • Reference.map
  • Reference.vb
  • Reference.disco
  • Reference.wsdl

所有这些文件中包含指向Web Service的URL。即使我将它移动到没有Visual Studio的机器上,它也能正常工作。但如果我打算更改Web服务的URL,则需要使用记事本编辑它们来修改所有这四个文件

取而代之的是,有没有什么办法可以在配置文件中拥有url,只需在一个地方修改它,然后web服务就会指向新的位置。

我正在使用框架1.1。

回答

1

设置Web服务引用的“URL行为”属性设置为动态,并会在你的app.config文件中cofigured地址....

app.config文件应然后包含类似

<applicationSettings> 
     <Exceptions.Properties.Settings> 
      <setting name="Exceptions_CentreService_CentreService" serializeAs="String"> 
       <value>http://localhost/CentreServiceCompatibility/CentreService.asmx</value> 
      </setting> 
     </Exceptions.Properties.Settings> 
    </applicationSettings>