简体   繁体   English

我可以控制TFS Build Server上的Web项目的端口号吗?

[英]Can I control Port Number of Web Projects on TFS Build Server?

I have a unit test project and several web sites set up in my VS2010 solution. 我在VS2010解决方案中有一个单元测试项目和几个网站。 The web sites are used to host WCF services and are configured in the solution to use static port numbers, so that my test project will know the address to find them on. 这些网站用于承载WCF服务,并在解决方案中配置为使用静态端口号,以便我的测试项目将知道在其上找到它们的地址。 The web sites run under the VS development server, as opposed to IIS. 这些网站在VS开发服务器下(而不是IIS)运行。 This works great on my machine, as well as any other developer who runs the test project through VS. 这对我的机器以及通过VS运行测试项目的任何其他开发人员都非常有效。 However, when the TFS build server tries to run the projects, it appears as though it is ignoring my static port numbers for the web sites. 但是,当TFS构建服务器尝试运行项目时,它似乎好像在忽略我的网站静态端口号。

I see errors in the event log indicating that the build server is trying to start up my web sites on port numbers that I did not indicate. 我在事件日志中看到错误,指示构建服务器正在尝试在我未指示的端口号上启动我的网站。 I checked out the build directory and found the files for the web sites in directories with the test project assemblies, but there is no indication that the solution file is referenced anywhere, which is the mechanism that VS uses to contain the static port numbers. 我签出了构建目录,并在带有测试项目程序集的目录中找到了网站的文件,但是没有迹象表明解决方案文件在任何地方都被引用,这是VS用来包含静态端口号的机制。 Is there a way for me to specify which ports the TFS build server will use to host my web sites from within the development web server when running a set of unit tests? 当运行一组单元测试时,我是否可以指定TFS构建服务器将使用哪些端口从开发Web服务器中托管我的网站?

Also, if it sounds like I am trying to attack this issue in the wrong way, please let me know. 另外,如果听起来我试图以错误的方式解决此问题,请告诉我。 This is my first experience with TFS build server, and I was really hoping to be able to have my automated unit tests be able to call my WCF services, somehow. 这是我第一次使用TFS构建服务器,我真的希望能够使自动化的单元测试能够以某种方式调用WCF服务。

So, I solved this by calling WebDev.WebServer40.exe as a process within my test code to start up my web sites with the ASP.Net Development Server. 因此,我通过调用WebDev.WebServer40.exe作为测试代码中的一个过程来解决此问题,以使用ASP.Net开发服务器启动网站。 This was very tricky, as I had to dynamically determine the location of the web site files at run time using a number of clues, since it is different between my local development environment and the build server. 这非常棘手,因为我必须使用许多线索在运行时动态确定网站文件的位置,因为本地开发环境和构建服务器之间存在差异。 I really wish there were a way to just use the AspNetDevelopmentServerAttribute to specify a known port number. 我真的希望有一种方法可以仅使用AspNetDevelopmentServerAttribute指定一个已知的端口号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM