Meu servidor não sobe, fiz um debug para ler o que estava acontecendo e descobri que nessa linha nunca retornavar contexto = httpListener.GetContext();
private void ManipularRequisicao()
{
var httpListener = new HttpListener();
foreach (var prefixo in _prefixos)
httpListener.Prefixes.Add(prefixo);
httpListener.Start();
var contexto = httpListener.GetContext();
var requisicao = contexto.Request;
var resposta = contexto.Response;
var path = requisicao.Url.AbsolutePath;
if (path.Equals("/Assets/css/styles.css"))
{
var assembly = Assembly.GetExecutingAssembly();
var nomeResource = "ByteBank.Portal.Assets.css.styles.css";
var resourceStream = assembly.GetManifestResourceStream(nomeResource);
var bytesResource = new byte[resourceStream.Length];
resourceStream.Read(bytesResource, 0,(int) resourceStream.Length);
resposta.ContentType = "text/css; charset=utf8";
resposta.StatusCode = 200;
resposta.ContentLength64 = bytesResource.Length;
resposta.OutputStream.Write(bytesResource, 0, bytesResource.Length);
resposta.OutputStream.Close();
}
else if (path.Equals("/Assets/js/main.js"))
{
var assembly = Assembly.GetExecutingAssembly();
var nomeResource = "ByteBank.Portal.Assets.js.mains.js";
var resourceStream = assembly.GetManifestResourceStream(nomeResource);
var bytesResource = new byte[resourceStream.Length];
resourceStream.Read(bytesResource, 0,(int) resourceStream.Length);
resposta.ContentType = "application/js; charset=utf8";
resposta.StatusCode = 200;
resposta.ContentLength64 = bytesResource.Length;
resposta.OutputStream.Write(bytesResource, 0, bytesResource.Length);
resposta.OutputStream.Close();
}
httpListener.Stop();
}