1
我試圖使用「Microsoft.Sdc.Tasks.Web.Website.UpdateHttpErrorSetting」更改遠程IIS網站的http錯誤消息。這項任務的文檔特別有些缺乏,我還沒有找到成功使用它的方法。我想要HTTP 404錯誤來加載一個URL而不是默認的404b.html文件。我使用任務這樣嘗試:如何使用MSBuild修改遠程IIS6網站的自定義錯誤
<Microsoft.Sdc.Tasks.Web.Website.UpdateHttpErrorSetting
ErrorCode="404"
MachineName="$(MachineName)"
WebSiteName="$(SiteName)"
Path="."
Uri="/errors/mycustom404.htm"
Type="URL"
DirectoryType="WebDir" />
我得到一個異常任務運行時,但我不是什麼我缺少明確:
Using "Microsoft.Sdc.Tasks.Web.Website.UpdateHttpErrorSetting" task from assembly "c:\Microsoft.Sdc.Tasks.dll".
Task "Microsoft.Sdc.Tasks.Web.Website.UpdateHttpErrorSetting"
error : A task error has occured.
error : Message = Object reference not set to an instance of an object.
error : ErrorCode = 404
error : SubErrorCode = <String.Empty>
error : Uri = /errors/mycustom404.htm
error : Type = URL
error : DirectoryType = WebDir
error : MachineName = testMachineName
error : WebSiteName = testSiteName
error : Path = .
error : DirectoryName = <String.Empty>
error :
error : at Microsoft.Sdc.Tasks.Web.WebSite.UpdateHttpErrorSetting.InternalExecute()
進一步的深入瞭解是非常受歡迎。