웹 서비스 설명에 개정 번호/빌드 번호를 표시 할 수 있습니까? 웹 서비스에 대한 URL로 이동할 때 현재 실행중인 버전을 사용자가 볼 수있게하고 싶습니다.C# 웹 서비스 설명에 개정 번호/빌드 번호 표시?
Ex.
[WebService(Namespace = "http://webservice.mydomain.com/", Name = "webservice for multimedia devices", Description = "Last build: **xxxxx**")]
은 내가이 (제안은 아래 참조) 시도 가능 (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
)
경우 동적으로 싶어. 이것은 설명을 가지고 있지만 클라이언트에게 웹 서비스를 보여주기 전에 업데이트 할 수 없습니다.
var t = typeof(webClient);
var att = (WebServiceAttribute)t.GetCustomAttributes(typeof(WebServiceAttribute), true)[0];
att.Description = "Current running version: " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
작동하지 않는 것 같습니다. 나는 이것을 추가했다 : var t = typeof (webClient); (WebServiceAttribute), false) [0]; att.Description = "현재 실행중인 버전 :"+ System.Reflection.Assembly.GetExecutingAssembly(). GetName(). Version; – Patrick
설명이 있지만 업데이트하지 않았습니다. 나는 .NET 3.5와 4를 사용하지 않는다는 것을 잊었다. – Patrick
커스텀 ServiceHostFactory (http://msdn.microsoft.com/en-us/library/system.servicemodel.activation.servicehostfactory)에이 코드를 추가 해 보았는가? aspx)? 나는 이것이 효과가 있다고 생각한다. – Peter