Lazily creating isolated storage - c#

My library is using isolated storage but only does so on demand. So I'm using Lazy<T>.
However, this throws:
System.IO.IsolatedStorage.IsolatedStorageException "Unable to determine granted permission for assembly."
Does Lazy do something weird with threads that confuses isolated storage initialization?
Sample code:
using System;
using System.IO.IsolatedStorage;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var thisWorks = IsolatedStorageFile.GetMachineStoreForAssembly();
thisWorks.Dispose();
var lazyStorage = new Lazy<IsolatedStorageFile>(IsolatedStorageFile.GetMachineStoreForAssembly);
var thisFails = lazyStorage.Value;
thisFails.Dispose();
}
}
}
Full stack trace:
System.IO.IsolatedStorage.IsolatedStorageException was unhandled
Message=Unable to determine granted permission for assembly.
Source=mscorlib
StackTrace:
Server stack trace:
at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetMachineStoreForAssembly()
at System.Lazy`1.CreateValue()
Exception rethrown at [0]:
at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetMachineStoreForAssembly()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at ConsoleApplication1.Program.Main(String[] args) in C:\Users\Andrew Davey\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Looks like it's because you're passing in a MethodGroup (rather than a delegate/lambda directly), and it's unable to figure out where the call originally came from. If you switch it to this:
var lazyStorage = new Lazy<IsolatedStorageFile>(() => IsolatedStorageFile.GetMachineStoreForAssembly());
It should work ok.

Related

Not able to download file - The remote server returned an error: (403) Forbidden

I'm trying to download a zip file in Windows Application , but is is throwing an error . My code is :
string url = "https://www.nseindia.com/content/historical/DERIVATIVES/2017/JUN/fo07JUN2017bhav.csv.zip";
using (WebClient wc = new WebClient())
{
wc.DownloadFile(url, #"c:\bhav\file.zip");
}
Exception details :
System.Net.WebException was unhandled HResult=-2146233079
Message=The remote server returned an error: (403) Forbidden.
Source=System StackTrace:
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at unzip.Form1.downloadFile() in c:\users\ethicpro\documents\visual studio
2015\Projects\unzip\unzip\Form1.cs:line 30
at unzip.Form1..ctor() in c:\users\ethicpro\documents\visual studio 2015\Projects\unzip\unzip\Form1.cs:line 20
at unzip.Program.Main() in c:\users\ethicpro\documents\visual studio 2015\Projects\unzip\unzip\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext
activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext
activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart() InnerException:
Link is : https://www.nseindia.com/content/historical/DERIVATIVES/2017/JUN/fo07JUN2017bhav.csv.zip
I searched for other questions but didn't get the proper answer.
Try this
string url = "https://www.nseindia.com/content/historical/DERIVATIVES/2017/JUN/fo07JUN2017bhav.csv.zip";
string fileName = #"C:\Temp\tt.zip";
using (WebClient wc = new WebClient())
{
wc.Headers.Add("User-Agent: Other");
wc.DownloadFile(url, fileName);
}
The file might no longer exist.
I use VB.Net.
But you have to use the equivalent of on error resume next on this file or another file with a more recent date with and without on error resume next. Or the equivalent in C#.
Another option is that some characters cannot be downloaded, like : | > or .csv.zip should be .zip without the .csv.

Creating a SQL server agent job via C# throws an "permission was denied on the object 'sp_add_operator' error

I am trying to create a SQL Server Agent job from simple windows console application but I'm receiving an The EXECUTE permission was denied on the object 'sp_add_operator', database 'msdb', schema 'dbo'. error. Steps are, define & create operator, job, job steps & job schedule. I am receiving an error on creating operator step. I've checked into SQL where I can see that access are granted to me but not sure why I am getting this error.
Code:
static void Main(string[] args)
{
Server srv = new Server();
srv.ConnectionContext.ConnectionString = "MyConnectionString";
srv.ConnectionContext.Connect();
Operator op = new Operator(srv.JobServer, "Test_Operator");
op.NetSendAddress = "Network1_PC";
op.Create(); // Error
Job jb = new Job(srv.JobServer, "Test_Job");
jb.OperatorToNetSend = "Test_Operator";
jb.NetSendLevel = CompletionAction.Always;
jb.Create();
JobStep jbstp = new JobStep(jb, "Test_Job_Step");
jbstp.Command = "Test_StoredProc";
jbstp.OnSuccessAction = StepCompletionAction.QuitWithSuccess;
jbstp.OnFailAction = StepCompletionAction.QuitWithFailure;
jbstp.Create();
//Define a JobSchedule object variable by supplying the parent job and name arguments in the constructor.
JobSchedule jbsch = new JobSchedule(jb, "Test_Job_Schedule");
jbsch.FrequencyTypes = FrequencyTypes.Daily;
jbsch.FrequencySubDayTypes = FrequencySubDayTypes.Minute;
jbsch.FrequencySubDayInterval = 30;
TimeSpan ts1 = new TimeSpan(9, 0, 0);
jbsch.ActiveStartTimeOfDay = ts1;
TimeSpan ts2 = new TimeSpan(17, 0, 0);
jbsch.ActiveEndTimeOfDay = ts2;
jbsch.FrequencyInterval = 1;
System.DateTime d = new System.DateTime(2003, 1, 1);
jbsch.ActiveStartDate = d;
jbsch.Create();
}
Error:
Microsoft.SqlServer.Management.Smo.FailedOperationException was unhandled
HelpLink=http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.3000.0+((SQL11_PCU_Main).121019-1322+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Operator&LinkId=20476
HResult=-2146233088
Message=Create failed for Operator 'Test_Operator'.
Source=Microsoft.SqlServer.Smo
Operation=Create
StackTrace:
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()
at Microsoft.SqlServer.Management.Smo.Agent.Operator.Create()
at JobUtilityTester.Program.Main(String[] args) in c:\Personal\Sample Projects\SQLServerJobUtility\JobUtilityTester\Program.cs:line 56
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: Microsoft.SqlServer.Management.Common.ExecutionFailureException
HResult=-2146233087
Message=An exception occurred while executing a Transact-SQL statement or batch.
Source=Microsoft.SqlServer.ConnectionInfo
StackTrace:
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ExecuteNonQuery(StringCollection queries, Boolean includeDbContext)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImplFinish(StringCollection createQuery, ScriptingPreferences sp)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()
InnerException: System.Data.SqlClient.SqlException
HResult=-2146232060
**Message=The EXECUTE permission was denied on the object 'sp_add_operator', database 'msdb', schema 'dbo'.**
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=14
LineNumber=1
Number=229
Procedure=sp_add_operator
Server=10.1.201.164
State=5
StackTrace:
at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
InnerException:
Screen Shots :

How can I use rebus with simpleinjector

In my company we are using SimpleInjector as our IoC framework and are now looking at using Rebus as a wrapper for sending messages via RabbitMq. I am looking for help in creating a working example. I have tried the following code:
using Rebus.Activation;
using Rebus.Config;
using Rebus.Handlers;
using Rebus.Pipeline;
using Rebus.RabbitMq;
using Rebus.SimpleInjector;
using SimpleInjector;
using System;
using System.Threading.Tasks;
namespace SearchType.ProjectionA
{
class Program
{
static void Main(string[] args)
{
var container = new Container();
container.Register<IContainerAdapter, SimpleInjectorContainerAdapter>();
container.Register<IHandleMessages<string>, Handler>();
var adapter = container.GetInstance<IContainerAdapter>();
var bus = Configure.With(adapter)
.Logging(l => l.ColoredConsole())
.Transport(t => t.UseRabbitMq("amqp://localhost", "simpleinjector_consumer"))
.Start();
bus.Subscribe<string>().Wait();
Console.WriteLine("Projection A listening - press ENTER to quit");
Console.ReadLine();
}
}
public class Handler : IHandleMessages<string>
{
public Task Handle(string message)
{
return Task.Run(() =>
{
Console.WriteLine(string.Format("{0} - {1}", MessageContext.Current.Message.Headers["rbs2-corr-id"], message));
});
}
}
}
When i try and run this console application I am getting the following error:
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=The container can't be changed after the first call to GetInstance, GetAllInstances and Verify. The following stack trace describes the location where the container was locked:
at SearchType.ProjectionA.Program.Main(String[] args) in C:\HRG\TravTech\Springboard\SearchType\SearchType.ProjectionA\Program.cs:line 34
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Source=SimpleInjector
StackTrace:
at SimpleInjector.Container.ThrowWhenContainerIsLocked()
at SimpleInjector.Container.AddRegistration(Type serviceType, Registration registration)
at SimpleInjector.Container.RegisterSingleton[TService](TService instance)
at Rebus.SimpleInjector.SimpleInjectorContainerAdapter.SetBus(IBus bus)
at Rebus.Config.RebusConfigurer.Start()
at SearchType.ProjectionA.Program.Main(String[] args) in C:\HRG\TravTech\Springboard\SearchType\SearchType.ProjectionA\Program.cs:line 36
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Does anyone know what I can do to fix this? I don't want to have to declare all the dependencies myself.
Edit: thank you Steven for your reply. I have changed the code according to your answer and am now getting a different error.
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=The configuration is invalid. Creating the instance for type IMessageContext failed. The registered delegate for type IMessageContext threw an exception. Attempted to inject the current message context from MessageContext.Current, but it was null! Did you attempt to resolve IMessageContext from outside of a Rebus message handler?
Source=SimpleInjector
StackTrace:
at SimpleInjector.InstanceProducer.VerifyInstanceCreation()
at SimpleInjector.Container.VerifyInstanceCreation(InstanceProducer[] producersToVerify)
at SimpleInjector.Container.VerifyThatAllRootObjectsCanBeCreated()
at SimpleInjector.Container.VerifyInternal(Boolean suppressLifestyleMismatchVerification)
at SimpleInjector.Container.Verify()
at SearchType.ProjectionA.Program.Main(String[] args) in C:\HRG\TravTech\Springboard\SearchType\SearchType.ProjectionA\Program.cs:line 27
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2146233088
Message=The registered delegate for type IMessageContext threw an exception. Attempted to inject the current message context from MessageContext.Current, but it was null! Did you attempt to resolve IMessageContext from outside of a Rebus message handler?
Source=SimpleInjector
StackTrace:
at SimpleInjector.InstanceProducer.GetInstance()
at SimpleInjector.InstanceProducer.VerifyInstanceCreation()
InnerException:
HResult=-2146233079
Message=Attempted to inject the current message context from MessageContext.Current, but it was null! Did you attempt to resolve IMessageContext from outside of a Rebus message handler?
Source=Rebus.SimpleInjector
StackTrace:
at Rebus.SimpleInjector.SimpleInjectorContainerAdapter.<SetBus>b__7()
at lambda_method(Closure )
at SimpleInjector.InstanceProducer.BuildAndReplaceInstanceCreatorAndCreateFirstInstance()
at SimpleInjector.InstanceProducer.GetInstance()
InnerException:
The error indicates that IMessageContext can only be instantiated inside a message handler. Is there a way to ignore certain errors?
I think the exception is clear; Simple Injector prevents registration after you already resolved. Reasons for doing this are described here.
The solution is to manually create the SimpleInjectorContainerAdapter and prevent relying on the container's auto-wiring capability for the adapter:
var container = new Container();
IContainerAdapter adapter = new SimpleInjectorContainerAdapter(container);
container.Register<IHandleMessages<string>, Handler>();
var bus = Configure.With(adapter)
.Logging(l => l.ColoredConsole())
.Transport(t => t.UseRabbitMq("amqp://localhost", "simpleinjector_consumer"))
.Start();
container.Verify();

CryptographicException (The parameter is incorrect) on Windows 8.1 but not Windows 7

I have some code that's been working fine on Windows 7 but fails now that I've started using a Windows 8.1 dev box (see repro code below).
Is RSA different on Windows 8.1 vs. Windows 7?
using System.Security.Cryptography;
using System.Text;
namespace RsaBug
{
class Program
{
static void Main()
{
var modulus = Encoding.UTF8.GetBytes("rvco6d27bsw2fw5qx7okdcu5jahd1ifh22is76k5xyau3wjv7plo0rom66h2434tvm29cmq2ov6mbjo30bymb14j2dst5fzy7pd");
var exponent = Encoding.UTF8.GetBytes("1ekh");
using (var rsa = new RSACryptoServiceProvider())
{
//Get an instance of RSAParameters from ExportParameters function.
var rsaKeyInfo = rsa.ExportParameters(false);
//Set RSAKeyInfo to the public key values.
rsaKeyInfo.Modulus = modulus;
rsaKeyInfo.Exponent = exponent;
//Import key parameters into RSA.
rsa.ImportParameters(rsaKeyInfo); // on Windows 8.1, this throws
}
}
}
}
Here's the exception I get:
System.Security.Cryptography.CryptographicException was unhandled
_HResult=-2147024809
_message=The parameter is incorrect.
HResult=-2147024809
IsTransient=false
Message=The parameter is incorrect.
Source=mscorlib
StackTrace:
at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
at System.Security.Cryptography.Utils._ImportKey(SafeProvHandle hCSP, Int32 keyNumber, CspProviderFlags flags, Object cspObject, SafeKeyHandle& hKey)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at RsaBug.Program.Main() in d:\sandbox\2015\RsaBug\RsaBug\Program.cs:line 24
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Based on the alphabet present it is likely that the modulus and exponent are base-36 encoded.

40400: Endpoint not found - Windows Service Bus

I am running on premise Windows Service Bus 1.0 and I am getting the exception MessaingEntityNotFoundException 40400: Endpoint not found.
Is this because the queue is not created? I cant see anywhere on the server where I can create queues (I'm using 2K8R2), when I run the Service Bus Configuration tool it only asks if I want to remove from the farm.
Do I need to add a queue, if so is there a gui or powershell script, or am I doing something else wrong?
Connection string in app.config
<appSettings>
<!-- Service Bus specific app setings for messaging connections -->
<add key="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://sqldev1.domain.local/domaintest1;StsEndpoint=https://sqldev1.domain.local:9355/domain-test1;RuntimePort=9354;ManagementPort=9355" />
</appSettings>
Code is below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using System.Threading.Tasks;
namespace WindowsServerEventBus
{
class Program
{
static void Main(string[] args)
{
MessagingFactory messageFactory = MessagingFactory.Create();
NamespaceManager namespaceManager = NamespaceManager.Create();
QueueClient myQueueClient = messageFactory.CreateQueueClient("WowWowWee");
BrokeredMessage sendMessage = new BrokeredMessage("Hello World!");
myQueueClient.Send(sendMessage);
BrokeredMessage receivedMessage = myQueueClient.Receive(TimeSpan.FromSeconds(5));
if (receivedMessage != null)
{
Console.WriteLine(string.Format("Message received: Body = {0}",
receivedMessage.GetBody<string>()));
receivedMessage.Complete();
}
messageFactory.Close();
Console.ReadLine();
}
}
}
Exception dump below:
Microsoft.ServiceBus.Messaging.MessagingEntityNotFoundException was unhandled
HResult=-2146233088
Message=40400: Endpoint not found..TrackingId:1271f18d-3fa7-4437-9f86-7276ff5909b4_Gsqldev1,TimeStamp:16/03/2013 19:05:33
Source=Microsoft.ServiceBus
IsTransient=false
StackTrace:
at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.EndSendCommand(IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.OnEndSend(IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.OnSend(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout)
at Microsoft.ServiceBus.Messaging.MessageSender.Send(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout)
at Microsoft.ServiceBus.Messaging.MessageSender.Send(BrokeredMessage message)
at Microsoft.ServiceBus.Messaging.QueueClient.Send(BrokeredMessage message)
at WindowsServerEventBus.Program.Main(String[] args) in c:\Users\user\Downloads\EventStore-master\EventStore-master\src\WindowsServerEventBus\Program.cs:line 78
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ServiceModel.FaultException
HResult=-2146233087
Message=40400: Endpoint not found..TrackingId:1271f18d-3fa7-4437-9f86-7276ff5909b4_Gsqldev1,TimeStamp:16/03/2013 19:05:33
Source=Microsoft.ServiceBus
Action=http://schemas.microsoft.com/servicebus/2010/08/protocol/Fault
StackTrace:
Server stack trace:
at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.ThrowIfFaultMessage(Message wcfMessage)
at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.HandleMessageReceived(IAsyncResult result)
Exception rethrown at [0]:
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.DuplexCorrelationAsyncResult.End(IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.EndRequest(IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncSteps>b__4(RequestAsyncResult thisPtr, IAsyncResult r)
at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
Exception rethrown at [1]:
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.RequestAsyncResult.<>c__DisplayClass17.<GetAsyncSteps>b__a(RequestAsyncResult thisPtr, IAsyncResult r)
at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
Exception rethrown at [2]:
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.EndRequest(IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncSteps>b__4(RequestAsyncResult thisPtr, IAsyncResult r)
at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
Exception rethrown at [3]:
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Sbmp.SbmpTransactionalAsyncResult`1.<GetAsyncSteps>b__36(TIteratorAsyncResult thisPtr, IAsyncResult a)
at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
Exception rethrown at [4]:
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.EndSendCommand(IAsyncResult result)
InnerException:
You can create the queue in your code by using the NameSpaceManager.
namespaceManager.CreateQueue("WowWowWee");
If you are using NimbusAPI which creates Azure service bus topics automatically, a topic that is not subscribed to by is automatically deleted after 367 days because it is idle. To resolve this, restart the service, and it should restore any missing topics.

Categories