Unable to host an NServiceBus Saga from another Service with SQL Persistence - msbuild

I am attempting to host a Saga from one project in another project using NServiceBus 6 with SqlPersistence and SqlDialect.MsSqlServer. In most examples I have found, the Saga is contained in the same assembly as the hosting app, and perhaps this is why I am struggling.
When hosting everything in the same app, the NServiceBus.Persistence.Sql.MsBuild package correctly outputs Saga .sql files during the build and then picks these up and executes them on run. Using a separate app, only the Outbox, Subscription and Timeout .sql files are generated, not the Saga ones. The following entry is then logged on run:
INFO NServiceBus.Persistence.Sql.Installer Directory '[PATH]\SagaPersistence\Service\bin\Debug\NServiceBus.Persistence.Sql\MsSqlServer\Sagas' not found so no saga creation scripts will be executed.
A full VS 2017 repro may be found at https://github.com/WolfyUK/NServiceBusSagaSqlPersistence.
Firstly, is it a bad idea to host a Sagas from another service, rather than being self-hosted? If not, can someone advise the best way to resolve the SQL Persistence issue?

Can you add NServiceBus.Persistence.Sql.MsBuild to the Saga project? The scripts should then be found there. Unfortunately they're not copied to the host its folder, so you'll have to take them from there into production. Or have them generated by using EnableInstallers, like you're already doing.

Related

Mule 4 Runtime - Clear Application Data of a batch process

I was having intermittent issue running a Mule Batch with huge data in Anypoint Studio. That issue is resolved by enabling 'Always' option under 'Clear Application Data' in 'Run Configurations' (as per the given instruction in Mule ESB - Clear Memory of a batch process). That option is shown in the picture.
How to enable the same 'Always' option in stand alone Mule Runtime during the startup that means when we are not running the batch from Anypoint Studio? Is there any command line argument available that can be used in startup script of the Mule Runtime to achieve the same goal?
By deleting the local data you are deleting batch queues, persistent objects stores and maybe some other information. In a development environment like Anypoint Studio IDE it is usually OK but for a standalone Mule Runtime it means you are deleting production data, for example records that are used by batch to continue processing after a restart. That data will be lost. Having said that, it might be needed if the data is completely corrupted.
It is a best practice and a strong advice to any user to resolve the root cause of the issue rather than delete data. And it should never be done every time you start your production Mule, only when there is absolutely no other alternative.
I don't recommend to delete local files at all. If even after my warnings you absolutely need to do this never ever delete the .mule directory. If you still want to risk losing data delete only the directory with the application name under the .mule directory.

Want to deploy WCF web service on Azure platform

I want to deploy my WCF web Service on Azure plateform.
I have created a Storage account for my website, and also created a cloud Service and uploaded my package file and config file to the staging site.
But while uploading, The message displays
'Your staging deployment is starting. Hang on, the page will refresh once the deployment begins.'
I am waiting sice 2-3 hours and not getting the desired output.
Am I doing correctly? Or is there anything that I forgot?
Please Help...!
Most likely there is a problem in your code or the packaging that is causing the role to continuously restart. This is a fairly common problem, but there are a lot of possible causes (missing an assembly reference, an uncaught exception, the Run() method is exiting, a Startup Task is failing, or many other things). You need to gather more information to know exactly what the problem is and how to fix it.
There are many threads here on SO about this topic. There's also a Microsoft post discussing how to diagnose this type of issue. Those are good places to start.

Publish Biztalk WCF Service with multiple schema files and <includes>

What I have here is this:
A Biztalk project in Visual Studio 2010, a corresponding Biztalk application running on a Biztalk 2010 server. The receive port accepts an HL7-V3 schema, transforms it to a schema that is sent off to a SQL server 2008 instance and inserted into tables via a stored procedure. When the receive port is using the FILE adapter, all works as intended (data from the HL7 file is inserted into tables).
So, we reached the point where a web service was needed in order to expose the Receive port via the web...great we have the "Biztalk WCF Service Publishing Wizard" built right into VS2010. This is where I'm stopped in my tracks.
I can follow the wizard as far as the "Create" step, it makes it about half-way to the Extracting Schemas from Biztalk Assembly then it barfs and throws a generic error:
"The given key was not present in the dictionary"
After much searching and head scratching, I was finally led to fact that the wizard uses Xsd.exe (new to me) to generate code from the schemas. This led me to the MSDN library article Here which states that included schemas are ignored by Xsd.exe. Well, the HL7V3 schema-set for the message we are using has about 30 files altogether - all referencing each other all over the place like so:
<xs:include schemaLocation="../coreschemas/infrastructureRoot.xsd"/>
<xs:include schemaLocation="COCT_MT050002UV07.xsd"/>
<xs:include schemaLocation="COCT_MT090100UV01.xsd"/>
<xs:include schemaLocation="COCT_MT240000UV01.xsd"/>
<xs:include schemaLocation="COCT_MT150000UV02.xsd"/>
So there's my problem.
So now my question is this: Is there a way to manually create a WCF service from a Biztalk project, or better yet, just get the Wizard to work for this case? Or, just any suggestions on where to look, as this is my first Biztalk project.
My Googling has only come up with a plethora of how-to's for the Wizard.
Well, the problem has been solved, despite running down way too many rabbit holes, I stumbled upon an MSDN called Getting Started with HL7 v3 and Biztalk Server 2006 article with a little section called Schema Modifications. One of the modifications is to add Target Namespace to some of the coreschema files in HL7 v3.
I had seen this doc in the past and it mentions that this fixes the issue of them being not supported when compiling schemas in BizTalk Server. I kind of ignored it because I was getting no errors and besides, I was using 2010, not 2006 so I naively thought "that must be fixed now...no errors"
Not so, I did exactly as the document suggested and immediately deployed and ran the Biztalk WCF Service Publishing Wizard and it all worked and I was able to view the help and .wsdl pages that were generated.
I hope this helps someone in the future. Very anti-climactic for me.

WCF service deployed to Azure

I have create a WCF Service Web Role project.I can consume the service locally. But I am having issues trying to deploy the service on the azure cloud. After starting the webrole it justs kepps going in a loop where it init then stops. I have not made any changes to the default WebRoleclass that was added automatically. Can anybody point me to some samples or examples of WCF being deployed to azure
The behaviour you're seeing occurs when the instance errors in the OnStart or Run. The usual diagnostics error trapping hasn't had a chance to start yet so this is a difficult problem to debug. You might try adding error trapping inside this functions that writes the error details out to either a blob or a queue so that you can see what is actually happening.
Having said that, with code that works in the dev fabric, but continues to cycle when deployed to live, the first thing to check is that all of the references have the appropriate "Copy Local" property set. Anything that is part of the framework or Microsoft.WindowsAzure.ServiceRuntime will need to have Copy Local to false, everything else should be set to true (third party assemblies an the like). If this is a web role and you're using MVC, you'll need to check that System.Web.Mvc has Copy Local set to true as well as this is not included as part of the standard framework deployed in Azure.
Have you looked at the Known Issues information on the WCF Azure code page? There's a patch that's needed, as well as a tweak to the service behavior. Hopefully this will help you.
I just found out the root of the problem. It was caused by one of my projects having the target platform set to x86. Seems like it does not support x86 build assemblies which can be a problem

FluentNHibernate blows up in Windows Service but not website

I've got a class library doing all my NHibernate stuff. It also handles all the mapping using Fluent NHibernate - no mapping files to deploy.
This class library is consumed by a number of apps, including a Windows Service running on my computer. Although it works fine in all my web apps, the Windows Service gets this when it tries to use NHibernate:
An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
at Kctc.NHibernate.KctcSessionFactory.get_SessionFactory() in C:\Kctc\Trunk\Kctc.NHibernate\KctcSessionFactory.cs:line 28
...more stack trace...
I have checked for an InnerException and there doesn't appear to be one. I have no idea what the PotentialReasons collection is, and Google doesn't seem to be forthcoming either.
This is my dev machine, so when I'm working on my web apps they run locally (i.e. using the web server in Visual Studio). The fact that the Windows Service and my dev web apps are running on this same machine suggest it's not to do with trust settings or what have you.
Can anyone suggest what I should try? This is one of those ones where I'm so stumped I can't even think of how to get more information about the problem.
Just a wild guess. NHibernate picks up the hibernate.cfg.xml file from the execution directory. Did you configure the execution directory of the service that it can find this file?
I've found out what the problem is. The Service did not deploy with the required NHibernate.ByteCode.LinFu.dll.
I appear to have an ongoing problem with the Visual Studio compiler not always copying indirect dependencies (i.e. dlls required by class libraries required by the app) into the output folder during the build. I should have thought of this sooner really.
Thanks for racking your brains on my behalf guys.
I bet the name of the connection string is missing from the app.config. For me that message is almost exclusively a missing connection string.
Are you targeting the same database or could it be some sort of schema mismatch between databases?
Could it be authentication issues on the service like you use windows authentication where it can't be used (or the sql authentication that doesn't work)?
It's hard to tell when there is no code, just an exception!
EDIT Are you ever using HttpContext, HostingEnvironment or anything else specific to "web"?