2013-05-20 8 views
0

ASP.NET WEB API를 사용하여 Atompub 서비스를 만들려고하는데 괜찮습니다.하지만 Windows Live Writer에서 이미지를 게시하려고하면 "이 블로그는 보이지 않습니다. 이미지로드를 허용하지 않습니다. "나는 ietf doc을 읽고 있습니다.AtomPub ASPNET Web Api 서버에서 이미지 허용

내 서비스 컨트롤러 코드 :

public class ServicesController : ApiController 
{ 
    public HttpResponseMessage Get() 
    { 
     var serviceDocument = new ServiceDocument(); 
     var workSpace = new Workspace 
     { 
      Title = new TextSyndicationContent("Nicoloco Site"), 
      BaseUri = new Uri(Request.RequestUri.GetLeftPart(UriPartial.Authority)) 
     }; 
     var posts = new ResourceCollectionInfo("Nicoloco Blog", 
               new Uri(Url.Link("DefaultApi", new { controller = "blogapi" }))); 
     posts.Accepts.Add("application/atom+xml;type=entry"); 
     var images = new ResourceCollectionInfo("Images Blog", 
               new Uri(Url.Link("DefaultApi", new { controller = "images" }))); 
     images.Accepts.Add("image/png"); 
     images.Accepts.Add("image/jpeg"); 
     images.Accepts.Add("image/jpg"); 
     images.Accepts.Add("image/gif"); 
     var categoriesUri = new Uri(Url.Link("DefaultApi", new { controller = "tags", format = "atomcat" })); 
     var categories = new ReferencedCategoriesDocument(categoriesUri); 
     posts.Categories.Add(categories); 
     workSpace.Collections.Add(posts); 
     workSpace.Collections.Add(images); 
     serviceDocument.Workspaces.Add(workSpace); 
     var response = new HttpResponseMessage(HttpStatusCode.OK); 
     var formatter = new AtomPub10ServiceDocumentFormatter(serviceDocument); 
     var stream = new MemoryStream(); 
     using (var writer = XmlWriter.Create(stream)) 
     { 
      formatter.WriteTo(writer); 
     } 
     stream.Position = 0; 
     var content = new StreamContent(stream); 
     response.Content = content; 
     response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/atomsvc+xml"); 
     return response; 
    } 
} 

는 HTTP GET 요청은 다음과 XML을 생성합니다

<?xml version="1.0" encoding="utf-8"?> 
<app:service 
    xmlns:a10="http://www.w3.org/2005/Atom" 
    xmlns:app="http://www.w3.org/2007/app"> 
    <app:workspace xml:base="http://localhost:53644/"> 
     <a10:title type="text">Nicoloco Site</a10:title> 
     <app:collection href="http://localhost:53644/api/blogapi"> 
      <a10:title type="text">Nicoloco Blog</a10:title> 
      <app:accept>application/atom+xml;type=entry</app:accept> 
      <app:categories href="http://localhost:53644/api/tags?format=atomcat" /> 
     </app:collection> 
     <app:collection href="http://localhost:53644/api/images"> 
      <a10:title type="text">Images Blog</a10:title> 
      <app:accept>image/png</app:accept> 
      <app:accept>image/jpeg</app:accept> 
      <app:accept>image/jpg</app:accept> 
      <app:accept>image/gif</app:accept> 
     </app:collection> 
    </app:workspace> 
</app:service> 

하지만이 서비스를 사용하여 이미지를 게시 할 수 없습니다.

감사합니다.

답변

1

내가 "카테고리 라인"내 오류를 발견, WLW 로그 파일 내가 그것을 제거,이 라인에서 잘못된 XML 오류를 표시하고 모든 this 블로그 게시물에서 ... 나를 위해 잘 작동은 WLW 이미지 파일

를 함께 작동 방법을 설명합니다

누군가 의견이 있으시면 ... 감사하겠습니다.