本文整理汇总了C#中System.Net.IPEndPoint.ToHttpUrl方法的典型用法代码示例。如果您正苦于以下问题:C# IPEndPoint.ToHttpUrl方法的具体用法?C# IPEndPoint.ToHttpUrl怎么用?C# IPEndPoint.ToHttpUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.IPEndPoint
的用法示例。
在下文中一共展示了IPEndPoint.ToHttpUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToServiceDocument
public static ServiceDocument ToServiceDocument(IEnumerable<string> userStreams,
IEnumerable<string> systemStreams,
IPEndPoint httpEndPoint)
{
if (userStreams == null || systemStreams == null || httpEndPoint == null)
return null;
var document = new ServiceDocument();
var userWorkspace = new WorkspaceElement();
userWorkspace.SetTitle("User event streams");
var systemWorkspace = new WorkspaceElement();
systemWorkspace.SetTitle("System event streams");
foreach (var userStream in userStreams)
{
var collection = new CollectionElement();
collection.SetTitle(userStream);
collection.SetUri(httpEndPoint.ToHttpUrl("/streams/{0}", userStream));
collection.AddAcceptType(ContentType.Xml);
collection.AddAcceptType(ContentType.Atom);
collection.AddAcceptType(ContentType.Json);
collection.AddAcceptType(ContentType.AtomJson);
userWorkspace.AddCollection(collection);
}
foreach (var systemStream in systemStreams)
{
var collection = new CollectionElement();
collection.SetTitle(systemStream);
collection.SetUri(httpEndPoint.ToHttpUrl("/streams/{0}", systemStream));
collection.AddAcceptType(ContentType.Xml);
collection.AddAcceptType(ContentType.Atom);
collection.AddAcceptType(ContentType.Json);
collection.AddAcceptType(ContentType.AtomJson);
systemWorkspace.AddCollection(collection);
}
document.AddWorkspace(userWorkspace);
document.AddWorkspace(systemWorkspace);
return document;
}
示例2: MiniClusterNode
public MiniClusterNode(
string pathname, int debugIndex, IPEndPoint internalTcp, IPEndPoint internalTcpSec, IPEndPoint internalHttp,
IPEndPoint externalTcp, IPEndPoint externalTcpSec, IPEndPoint externalHttp, IPEndPoint[] gossipSeeds,
ISubsystem[] subsystems = null, int? chunkSize = null, int? cachedChunkSize = null,
bool enableTrustedAuth = false, bool skipInitializeStandardUsersCheck = true, int memTableSize = 1000,
bool inMemDb = true, bool disableFlushToDisk = false)
{
RunningTime.Start();
RunCount += 1;
_dbPath = Path.Combine(
pathname,
string.Format(
"mini-cluster-node-db-{0}-{1}-{2}", externalTcp.Port, externalTcpSec.Port, externalHttp.Port));
Directory.CreateDirectory(_dbPath);
FileStreamExtensions.ConfigureFlush(disableFlushToDisk);
Db =
new TFChunkDb(
CreateDbConfig(chunkSize ?? ChunkSize, _dbPath, cachedChunkSize ?? CachedChunkSize, inMemDb));
InternalTcpEndPoint = internalTcp;
InternalTcpSecEndPoint = internalTcpSec;
InternalHttpEndPoint = internalHttp;
ExternalTcpEndPoint = externalTcp;
ExternalTcpSecEndPoint = externalTcpSec;
ExternalHttpEndPoint = externalHttp;
var singleVNodeSettings = new ClusterVNodeSettings(
Guid.NewGuid(), debugIndex, InternalTcpEndPoint, InternalTcpSecEndPoint, ExternalTcpEndPoint,
ExternalTcpSecEndPoint, InternalHttpEndPoint, ExternalHttpEndPoint,
new Data.GossipAdvertiseInfo(InternalTcpEndPoint, InternalTcpSecEndPoint,
ExternalTcpEndPoint, ExternalTcpSecEndPoint,
InternalHttpEndPoint, ExternalHttpEndPoint),
new[] {InternalHttpEndPoint.ToHttpUrl()}, new[]{ExternalHttpEndPoint.ToHttpUrl()}, enableTrustedAuth, ssl_connections.GetCertificate(), 1, false,
"", gossipSeeds, TFConsts.MinFlushDelayMs, 3, 2, 2, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2),
false, "", false, TimeSpan.FromHours(1), StatsStorage.None, 0,
new InternalAuthenticationProviderFactory(), disableScavengeMerging: true, adminOnPublic: true,
statsOnPublic: true, gossipOnPublic: true, gossipInterval: TimeSpan.FromSeconds(1),
gossipAllowedTimeDifference: TimeSpan.FromSeconds(1), gossipTimeout: TimeSpan.FromSeconds(1),
extTcpHeartbeatTimeout: TimeSpan.FromSeconds(10), extTcpHeartbeatInterval: TimeSpan.FromSeconds(10),
intTcpHeartbeatTimeout: TimeSpan.FromSeconds(10), intTcpHeartbeatInterval: TimeSpan.FromSeconds(10),
verifyDbHash: false, maxMemtableEntryCount: memTableSize, developmentMode: false);
Log.Info(
"\n{0,-25} {1} ({2}/{3}, {4})\n" + "{5,-25} {6} ({7})\n" + "{8,-25} {9} ({10}-bit)\n"
+ "{11,-25} {12}\n" + "{13,-25} {14}\n" + "{15,-25} {16}\n" + "{17,-25} {18}\n" + "{19,-25} {20}\n\n",
"ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp,
"OS:", OS.OsFlavor, Environment.OSVersion, "RUNTIME:", OS.GetRuntimeVersion(),
Marshal.SizeOf(typeof (IntPtr))*8, "GC:",
GC.MaxGeneration == 0
? "NON-GENERATION (PROBABLY BOEHM)"
: string.Format("{0} GENERATIONS", GC.MaxGeneration + 1), "DBPATH:", _dbPath, "ExTCP ENDPOINT:",
ExternalTcpEndPoint, "ExTCP SECURE ENDPOINT:", ExternalTcpSecEndPoint, "ExHTTP ENDPOINT:",
ExternalHttpEndPoint);
Node = new ClusterVNode(Db, singleVNodeSettings, infoController: new InfoController(null, ProjectionType.None), subsystems: subsystems, gossipSeedSource: new KnownEndpointGossipSeedSource(gossipSeeds));
Node.ExternalHttpService.SetupController(new TestController(Node.MainQueue));
}
示例3: MiniNode
public MiniNode(string pathname)
{
var ip = GetLocalIp();
int extTcpPort = GetAvailablePort(ip);
int extHttpPort = GetAvailablePort(ip);
_dbPath = Path.Combine(pathname, string.Format("mini-node-db-{0}-{1}", extTcpPort, extHttpPort));
Directory.CreateDirectory(_dbPath);
_tfChunkDb = new TFChunkDb(CreateOneTimeDbConfig(1024*1024, _dbPath, 1));
TcpEndPoint = new IPEndPoint(ip, extTcpPort);
HttpEndPoint = new IPEndPoint(ip, extHttpPort);
var singleVNodeSettings = new SingleVNodeSettings(TcpEndPoint,
HttpEndPoint,
new[] {HttpEndPoint.ToHttpUrl()},
1,
1,
1,
TimeSpan.FromHours(1),
StatsStorage.None);
_node = new SingleVNode(_tfChunkDb, singleVNodeSettings, dbVerifyHashes: true, memTableEntryCount: 1000);
}
示例4: CreateTransient
public Task CreateTransient(IPEndPoint endPoint, string name, string query, UserCredentials userCredentials = null)
{
return SendPost(
endPoint.ToHttpUrl("/projections/transient?name={0}&type=JS", name),
query,
userCredentials,
HttpStatusCode.Created);
}
示例5: ListOneTime
public Task<List<ProjectionDetails>> ListOneTime(IPEndPoint endPoint, UserCredentials userCredentials = null)
{
return SendGet(endPoint.ToHttpUrl("/projections/onetime"), userCredentials, HttpStatusCode.OK)
.ContinueWith(x =>
{
if (x.IsFaulted) throw x.Exception;
var r = JObject.Parse(x.Result);
return r["projections"] != null ? r["projections"].ToObject<List<ProjectionDetails>>() : null;
});
}
示例6: GetUser
public Task<UserDetails> GetUser(IPEndPoint endPoint, string login, UserCredentials userCredentials = null)
{
return SendGet(endPoint.ToHttpUrl("/users/{0}", login), userCredentials, HttpStatusCode.OK)
.ContinueWith(x =>
{
if (x.IsFaulted) throw x.Exception;
var r = JObject.Parse(x.Result);
return r["data"] != null ? r["data"].ToObject<UserDetails>() : null;
});
}
示例7: MiniNode
private MiniNode(int externalTcpPort = 41111, int externalHttpPort = 41112)
{
_oneTimeDbPath = Path.Combine(Path.GetTempPath(), string.Format("mini-node-one-time-db-{0}-{1}", externalTcpPort, externalHttpPort));
TryDeleteDirectory(_oneTimeDbPath);
Directory.CreateDirectory(_oneTimeDbPath);
_tfChunkDb = new TFChunkDb(CreateOneTimeDbConfig(256*1024*1024, _oneTimeDbPath, 2));
var ip = GetLocalIp();
TcpEndPoint = new IPEndPoint(ip, externalTcpPort);
HttpEndPoint = new IPEndPoint(ip, externalHttpPort);
var singleVNodeSettings = new SingleVNodeSettings(TcpEndPoint, HttpEndPoint, new[] {HttpEndPoint.ToHttpUrl()});
var appSettings = new SingleVNodeAppSettings(TimeSpan.FromHours(1));
_node = new SingleVNode(_tfChunkDb, singleVNodeSettings, appSettings, dbVerifyHashes: true);
}
示例8: GetPartitionResultAsync
public Task<string> GetPartitionResultAsync(IPEndPoint endPoint, string name, string partition, UserCredentials userCredentials = null)
{
return SendGet(endPoint.ToHttpUrl("/projection/{0}/result?partition={1}", name, partition), userCredentials, HttpStatusCode.OK);
}
示例9: MiniNode
public MiniNode(string pathname,
int? tcpPort = null, int? tcpSecPort = null, int? httpPort = null,
ISubsystem[] subsystems = null,
int? chunkSize = null, int? cachedChunkSize = null, bool enableTrustedAuth = false, bool skipInitializeStandardUsersCheck = true,
int memTableSize = 1000,
bool inMemDb = true, bool disableFlushToDisk = false)
{
if (_running) throw new Exception("Previous MiniNode is still running!!!");
_running = true;
RunningTime.Start();
RunCount += 1;
IPAddress ip = IPAddress.Loopback; //GetLocalIp();
int extTcpPort = tcpPort ?? PortsHelper.GetAvailablePort(ip);
int extSecTcpPort = tcpSecPort ?? PortsHelper.GetAvailablePort(ip);
int extHttpPort = httpPort ?? PortsHelper.GetAvailablePort(ip);
int intTcpPort = PortsHelper.GetAvailablePort(ip);
int intSecTcpPort = PortsHelper.GetAvailablePort(ip);
int intHttpPort = PortsHelper.GetAvailablePort(ip);
_dbPath = Path.Combine(pathname, string.Format("mini-node-db-{0}-{1}-{2}", extTcpPort, extSecTcpPort, extHttpPort));
Directory.CreateDirectory(_dbPath);
FileStreamExtensions.ConfigureFlush(disableFlushToDisk);
Db = new TFChunkDb(CreateDbConfig(chunkSize ?? ChunkSize, _dbPath, cachedChunkSize ?? CachedChunkSize, inMemDb));
TcpEndPoint = new IPEndPoint(ip, extTcpPort);
TcpSecEndPoint = new IPEndPoint(ip, extSecTcpPort);
HttpEndPoint = new IPEndPoint(ip, extHttpPort);
IntTcpEndPoint = new IPEndPoint(ip,intTcpPort);
IntSecTcpEndPoint = new IPEndPoint(ip, intSecTcpPort);
IntHttpEndPoint = new IPEndPoint(ip, intHttpPort);
var vNodeSettings = new ClusterVNodeSettings(Guid.NewGuid(),
0,
IntTcpEndPoint,
IntSecTcpEndPoint,
TcpEndPoint,
TcpSecEndPoint,
IntHttpEndPoint,
HttpEndPoint,
new [] {HttpEndPoint.ToHttpUrl()},
enableTrustedAuth,
ssl_connections.GetCertificate(),
1,
false,
"whatever",
new IPEndPoint[] {},
TFConsts.MinFlushDelayMs,
1,
1,
1,
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(2),
false,
"",
false,
TimeSpan.FromHours(1),
StatsStorage.None,
1,
new InternalAuthenticationProviderFactory(),
true,
true,
true,
false,
TimeSpan.FromSeconds(30),
TimeSpan.FromSeconds(30),
TimeSpan.FromSeconds(10),
TimeSpan.FromSeconds(10),
TimeSpan.FromSeconds(10),
TimeSpan.FromSeconds(10),
TimeSpan.FromSeconds(10),
false,
memTableSize);
Log.Info("\n{0,-25} {1} ({2}/{3}, {4})\n"
+ "{5,-25} {6} ({7})\n"
+ "{8,-25} {9} ({10}-bit)\n"
+ "{11,-25} {12}\n"
+ "{13,-25} {14}\n"
+ "{15,-25} {16}\n"
+ "{17,-25} {18}\n"
+ "{19,-25} {20}\n\n",
"ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp,
"OS:", OS.OsFlavor, Environment.OSVersion,
"RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8,
"GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1),
"DBPATH:", _dbPath,
"TCP ENDPOINT:", TcpEndPoint,
"TCP SECURE ENDPOINT:", TcpSecEndPoint,
"HTTP ENDPOINT:", HttpEndPoint);
Node = new ClusterVNode(Db, vNodeSettings, new KnownEndpointGossipSeedSource(new [] {HttpEndPoint}), subsystems);
Node.ExternalHttpService.SetupController(new TestController(Node.MainQueue));
}
示例10: SingleVNode
public SingleVNode(TFChunkDb db, SingleVNodeSettings vNodeSettings, SingleVNodeAppSettings appSettings)
{
Ensure.NotNull(db, "db");
Ensure.NotNull(vNodeSettings, "vNodeSettings");
db.OpenVerifyAndClean();
_tcpEndPoint = vNodeSettings.ExternalTcpEndPoint;
_httpEndPoint = vNodeSettings.HttpEndPoint;
_outputBus = new InMemoryBus("OutputBus");
_controller = new SingleVNodeController(Bus, _httpEndPoint);
_mainQueue = new QueuedHandler(_controller, "MainQueue");
_controller.SetMainQueue(MainQueue);
//MONITORING
var monitoringInnerBus = new InMemoryBus("MonitoringInnerBus", watchSlowMsg: false);
var monitoringRequestBus = new InMemoryBus("MonitoringRequestBus", watchSlowMsg: false);
var monitoringQueue = new QueuedHandler(monitoringInnerBus, "MonitoringQueue", watchSlowMsg: true, slowMsgThresholdMs: 100);
var monitoring = new MonitoringService(monitoringQueue, monitoringRequestBus, db.Config.WriterCheckpoint, appSettings.StatsPeriod);
Bus.Subscribe(monitoringQueue.WidenFrom<SystemMessage.SystemInit, Message>());
Bus.Subscribe(monitoringQueue.WidenFrom<SystemMessage.BecomeShuttingDown, Message>());
monitoringInnerBus.Subscribe<SystemMessage.SystemInit>(monitoring);
monitoringInnerBus.Subscribe<SystemMessage.BecomeShuttingDown>(monitoring);
monitoringInnerBus.Subscribe<MonitoringMessage.GetFreshStats>(monitoring);
//STORAGE SUBSYSTEM
var indexPath = Path.Combine(db.Config.Path, "index");
var tableIndex = new TableIndex(indexPath,
() => new HashListMemTable(),
new InMemoryCheckpoint(),
maxSizeForMemory: 1000000,
maxTablesPerLevel: 2);
var readIndex = new ReadIndex(_mainQueue,
db,
() => new TFChunkReader(db, db.Config.WriterCheckpoint),
TFConsts.ReadIndexReaderCount,
db.Config.WriterCheckpoint,
tableIndex,
new XXHashUnsafe());
var writer = new TFChunkWriter(db);
var storageWriter = new StorageWriter(_mainQueue, _outputBus, writer, readIndex);
var storageReader = new StorageReader(_mainQueue, _outputBus, readIndex, TFConsts.StorageReaderHandlerCount);
monitoringRequestBus.Subscribe<MonitoringMessage.InternalStatsRequest>(storageReader);
var chaser = new TFChunkChaser(db,
db.Config.WriterCheckpoint,
db.Config.GetNamedCheckpoint(Checkpoint.Chaser));
var storageChaser = new StorageChaser(_mainQueue, chaser);
_outputBus.Subscribe<SystemMessage.SystemInit>(storageChaser);
_outputBus.Subscribe<SystemMessage.SystemStart>(storageChaser);
_outputBus.Subscribe<SystemMessage.BecomeShuttingDown>(storageChaser);
var storageScavenger = new StorageScavenger(db, readIndex);
_outputBus.Subscribe<SystemMessage.ScavengeDatabase>(storageScavenger);
//TCP
var tcpService = new TcpService(MainQueue, _tcpEndPoint);
Bus.Subscribe<SystemMessage.SystemInit>(tcpService);
Bus.Subscribe<SystemMessage.SystemStart>(tcpService);
Bus.Subscribe<SystemMessage.BecomeShuttingDown>(tcpService);
//HTTP
HttpService = new HttpService(MainQueue, _httpEndPoint.ToHttpUrl());
Bus.Subscribe<SystemMessage.SystemInit>(HttpService);
Bus.Subscribe<SystemMessage.BecomeShuttingDown>(HttpService);
Bus.Subscribe<HttpMessage.SendOverHttp>(HttpService);
Bus.Subscribe<HttpMessage.UpdatePendingRequests>(HttpService);
HttpService.SetupController(new AdminController(MainQueue));
HttpService.SetupController(new PingController());
HttpService.SetupController(new StatController(monitoringQueue));
HttpService.SetupController(new ReadEventDataController(MainQueue));
HttpService.SetupController(new AtomController(MainQueue));
HttpService.SetupController(new WebSiteController(MainQueue));
//REQUEST MANAGEMENT
var requestManagement = new RequestManagementService(MainQueue, 1, 1);
Bus.Subscribe<ReplicationMessage.EventCommited>(requestManagement);
Bus.Subscribe<ReplicationMessage.CreateStreamRequestCreated>(requestManagement);
Bus.Subscribe<ReplicationMessage.WriteRequestCreated>(requestManagement);
Bus.Subscribe<ReplicationMessage.TransactionStartRequestCreated>(requestManagement);
Bus.Subscribe<ReplicationMessage.TransactionWriteRequestCreated>(requestManagement);
Bus.Subscribe<ReplicationMessage.TransactionCommitRequestCreated>(requestManagement);
Bus.Subscribe<ReplicationMessage.DeleteStreamRequestCreated>(requestManagement);
Bus.Subscribe<ReplicationMessage.RequestCompleted>(requestManagement);
Bus.Subscribe<ReplicationMessage.CommitAck>(requestManagement);
Bus.Subscribe<ReplicationMessage.PrepareAck>(requestManagement);
Bus.Subscribe<ReplicationMessage.WrongExpectedVersion>(requestManagement);
Bus.Subscribe<ReplicationMessage.InvalidTransaction>(requestManagement);
Bus.Subscribe<ReplicationMessage.StreamDeleted>(requestManagement);
Bus.Subscribe<ReplicationMessage.PreparePhaseTimeout>(requestManagement);
Bus.Subscribe<ReplicationMessage.CommitPhaseTimeout>(requestManagement);
var clientService = new ClientService();
Bus.Subscribe<TcpMessage.ConnectionClosed>(clientService);
Bus.Subscribe<ClientMessage.SubscribeToStream>(clientService);
Bus.Subscribe<ClientMessage.UnsubscribeFromStream>(clientService);
Bus.Subscribe<ClientMessage.SubscribeToAllStreams>(clientService);
Bus.Subscribe<ClientMessage.UnsubscribeFromAllStreams>(clientService);
//.........这里部分代码省略.........
示例11: Disable
public Task Disable(IPEndPoint endPoint, string login, UserCredentials userCredentials = null)
{
return SendPost(endPoint.ToHttpUrl("/users/{0}/command/disable", login), string.Empty, userCredentials, HttpStatusCode.OK);
}
示例12: CreateOneTime
public Task CreateOneTime(IPEndPoint endPoint, string query, UserCredentials userCredentials = null)
{
return SendPost(endPoint.ToHttpUrl("/projections/onetime?type=JS"), query, userCredentials, HttpStatusCode.Created);
}
示例13: Delete
public Task Delete(IPEndPoint endPoint, string name, bool deleteEmittedStreams, UserCredentials userCredentials = null)
{
return SendDelete(endPoint.ToHttpUrl("/projection/{0}?deleteEmittedStreams={1}", name, deleteEmittedStreams), userCredentials, HttpStatusCode.OK);
}
示例14: ResetPassword
public Task ResetPassword(IPEndPoint endPoint, string login, ResetPasswordDetails resetPasswordDetails,
UserCredentials userCredentials = null)
{
return SendPost(endPoint.ToHttpUrl("/users/{0}/command/reset-password", login), resetPasswordDetails.ToJson(), userCredentials, HttpStatusCode.OK);
}
示例15: ChangePassword
public Task ChangePassword(IPEndPoint endPoint, string login, ChangePasswordDetails changePasswordDetails,
UserCredentials userCredentials)
{
return SendPost(endPoint.ToHttpUrl("/users/{0}/command/change-password", login), changePasswordDetails.ToJson(), userCredentials, HttpStatusCode.OK);
}