0
클라이언트는 내 웹 API 응용 프로그램에서 바이너리 파일의 조건부 다운로드를 요청합니다. 하지만, 대부분의 현재 저를 부담스러워 무엇웹 API 응용 프로그램에서 제공하는 이진 파일을 App_Data 폴더에 저장해야합니까?
public HttpResponseMessage GetHHSetupUpdate(double clientVersion)
{
double currentVersion = getCurrentVersion("platypiRUs");
if (clientVersion >= currentVersion)
{
return null;
}
var path = @"C:\Platypi\PlatypiRUs.exe";
var stream = new FileStream(path, FileMode.Open);
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new StreamContent(stream);
result.Content.Headers.ContentType =
new MediaTypeHeaderValue("application/octet-stream");
return result;
}
파일의 위치입니다 :이 요청에 응답
방법은 아마 이런 일이 될 것입니다. 프로젝트의 App_Data 폴더 또는 다른 곳에 저장해야합니까?
그렇다면 (App_Data에 저장 됨) 어떻게 코드에서 참조 되는가? 그것은 같을까요 :
var path = @"\App_Data\PlatypiRUs.exe";
... 또는 ... ???
Server.MapPath가 해결되지 않기 때문에 HostingEnvironment가 바람직합니다. Microsoft.SQLServer.Server를 제공하지만 필요한 것은 아닙니다. –