Clean up samples so they work with current tooling.

This commit is contained in:
Chris Ross 2015-04-02 12:10:01 -07:00
Родитель 8e79c11c96
Коммит a2014e32c0
11 изменённых файлов: 40 добавлений и 69 удалений

Просмотреть файл

@ -1,20 +1,3 @@
// Copyright (c) Microsoft Open Technologies, Inc.
// All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
// WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF
// TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR
// NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing
// permissions and limitations under the License.
using System;
using System.Net.WebSockets;
using System.Text;

Просмотреть файл

@ -0,0 +1,9 @@
{
"profiles": {
"sample": {
"commandName": "sample",
"launchBrowser": true,
"launchUrl": "http://localhost:8080"
}
}
}

Просмотреть файл

@ -2,6 +2,9 @@
"dependencies": {
"Microsoft.Net.Http.Server": "1.0.0-*"
},
"commands": {
"sample": "HelloWorld"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {

Просмотреть файл

@ -0,0 +1,9 @@
{
"profiles": {
"web": {
"commandName": "web",
"launchBrowser": true,
"launchUrl": "http://localhost:12345"
}
}
}

Просмотреть файл

@ -2,6 +2,7 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.WebListener;
using Microsoft.Framework.Logging;
namespace HotAddSample
{
@ -10,8 +11,10 @@ namespace HotAddSample
// will be reset before the end of the request.
public class Startup
{
public void Configure(IApplicationBuilder app)
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
{
loggerfactory.AddConsole(LogLevel.Information);
var server = (ServerInformation)app.Server;
var listener = server.Listener;
listener.UrlPrefixes.Add("http://localhost:12346/pathBase/");
@ -34,7 +37,7 @@ namespace HotAddSample
await context.Response.WriteAsync("Error adding: " + toAdd + "<br>");
await context.Response.WriteAsync(ex.ToString().Replace(Environment.NewLine, "<br>"));
}
await context.Response.WriteAsync("<br><a href=\"/\">back</a>");
await context.Response.WriteAsync("<br><a href=\"" + context.Request.PathBase.ToUriComponent() + "\">back</a>");
await context.Response.WriteAsync("</body></html>");
return;
}
@ -58,7 +61,7 @@ namespace HotAddSample
{
await context.Response.WriteAsync("Not found: " + toRemove);
}
await context.Response.WriteAsync("<br><a href=\"/\">back</a>");
await context.Response.WriteAsync("<br><a href=\"" + context.Request.PathBase.ToUriComponent() + "\">back</a>");
await context.Response.WriteAsync("</body></html>");
return;
}
@ -75,7 +78,7 @@ namespace HotAddSample
await context.Response.WriteAsync("<a href=\"" + prefix + "\">" + prefix + "</a> <a href=\"?remove=" + prefix + "\">(remove)</a><br>");
}
await context.Response.WriteAsync("<form action=\"/\" method=\"GET\">");
await context.Response.WriteAsync("<form action=\"" + context.Request.PathBase.ToUriComponent() + "\" method=\"GET\">");
await context.Response.WriteAsync("<input type=\"text\" name=\"add\" value=\"http://localhost:12348\" >");
await context.Response.WriteAsync("<input type=\"submit\" value=\"Add\">");
await context.Response.WriteAsync("</form>");

Просмотреть файл

@ -1,17 +1,9 @@
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"exclude": [
"wwwroot"
],
"publishExclude": [
"**.kproj",
"**.user",
"**.vspscc"
],
"dependencies": {
"Microsoft.AspNet.Hosting": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*"
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.Framework.Logging.Console": "1.0.0-*"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345"

Просмотреть файл

@ -0,0 +1,9 @@
{
"profiles": {
"web": {
"commandName": "web",
"launchBrowser": true,
"launchUrl": "http://localhost:8080"
}
}
}

Просмотреть файл

@ -12,7 +12,6 @@
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>59517</DevelopmentServerPort>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
</Project>

Просмотреть файл

@ -1,20 +1,3 @@
// Copyright (c) Microsoft Open Technologies, Inc.
// All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
// WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF
// TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR
// NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing
// permissions and limitations under the License.
using System;
using System.Net.WebSockets;
using System.Text;
@ -23,7 +6,6 @@ using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.WebListener;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Logging.Console;
using Microsoft.Net.Http.Server;
namespace SelfHostServer

Просмотреть файл

@ -1,5 +1,4 @@
{
"webroot": "wwwroot",
"dependencies": {
"Microsoft.AspNet.Hosting": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",

Просмотреть файл

@ -1,20 +1,3 @@
// Copyright (c) Microsoft Open Technologies, Inc.
// All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
// WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF
// TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR
// NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing
// permissions and limitations under the License.
using System;
using System.Net;
using System.Net.Http;