共用方式為


AspNetDevelopmentServerAttribute 類別

更新:2007 年 11 月

指定進行測試時 ASP.NET 程式開發伺服器 (Development Server) 必須使用的設定。這主要是供 Web 服務單元測試之用。

命名空間:  Microsoft.VisualStudio.TestTools.UnitTesting.Web
組件:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (在 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 中)

語法

<AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple := True)> _
Public NotInheritable Class AspNetDevelopmentServerAttribute _
    Inherits Attribute

Dim instance As AspNetDevelopmentServerAttribute
[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = true)]
public sealed class AspNetDevelopmentServerAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Method, AllowMultiple = true)]
public ref class AspNetDevelopmentServerAttribute sealed : public Attribute
public final class AspNetDevelopmentServerAttribute extends Attribute

備註

當您使用 AspNetDevelopmentServerAttribute 執行測試時,ASP.NET 程式開發伺服器之執行個體便會啟動。您可以使用 TryUrlRedirection 將 Web 服務物件重新導向至這個伺服器,取代 Web 參考中所定義的伺服器。藉由指向伺服器,您可確定在執行 Web 服務測試時會有一個 ASP.NET 程式開發伺服器在已知的 URL 上啟動。

這個屬性是以方法為目標。這個屬性中的多個執行個體都可以套用至方法。

如需如何使用屬性的詳細資訊,請參閱使用屬性擴充中繼資料

繼承階層架構

System.Object
  System.Attribute
    Microsoft.VisualStudio.TestTools.UnitTesting.Web.AspNetDevelopmentServerAttribute

執行緒安全

這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。

請參閱

參考

AspNetDevelopmentServerAttribute 成員

Microsoft.VisualStudio.TestTools.UnitTesting.Web 命名空間

其他資源

ASP.NET 單元測試概觀

HOW TO:建立 ASP.NET 單元測試