我正在尝试使用“Microsoft.Sdc.Tasks.Web.Website.UpdateHttpErrorSetting”来更改远程 IIS 网站的 http 错误消息。特别是这项任务的文档有些缺乏,我还没有找到成功使用它的方法。我希望 http 404 错误加载一个 url 而不是默认的 404b.html 文件。我试过这样使用任务:
<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()
非常欢迎进一步的见解。