Web Deploy API (deploy .zip package) Clarification - api

I'm using the web deploy API to deploy a web package (.zip file, created by MSDeploy.exe) to programmatically roll the package out to a server (we need to do some other things before we release the package which is why we're not doing it all in one go using MSDeploy.exe).
Here's the code I have. My question is really to clarify what is happening when this is executed. In the package parameters XML file I have the application name specified ("Default Web Site") but that's about it, there's no other params are specified in there. From testing the server it appears the package gets deployed successfully but my question is are any other settings on the server I'm deploying to getting changed without my knowledge, are any default settings published etc.? Things like security settings, directory browsing etc. that I might not be aware of? The code here seems to deploy the package but I'm anxious about using this on a production environment when I'm so unsure of how this API works. The MS documentation is not helpful (more like non-existant, actually).
DeploymentChangeSummary changes;
string packageToDeploy = "C:/MyPackageLocation.zip";
string packageParametersFile = "C:/MyPackageLocation.SetParameters.xml";
DeploymentBaseOptions destinationOptions = new DeploymentBaseOptions()
{
UserName = "MyUsername",
Password = "MyPassword",
ComputerName = "localhost"
};
using (DeploymentObject deploymentObject = DeploymentManager.CreateObject(DeploymentWellKnownProvider.Package,
packageToDeploy))
{
deploymentObject.SyncParameters.Load(packageParametersFile);
DeploymentSyncOptions syncOptions = new DeploymentSyncOptions();
syncOptions.WhatIf = false;
//Deploy the package to the server.
changes = deploymentObject.SyncTo(destinationOptions, syncOptions);
}
If anyone could clarify that this snippet should deploy a package to a web site application on a server, without changing any existing server settings (unless specified in the SetParameters.xml file) that would be really helpful. Any good resources on using the API or an explanation of how web deployment works behind the scenes would also be much appreciated!

The setparameters file just controls the value for the parameters defined in the package. A package might be doing much more than that. Web deploy has a concept of providers and any given package can have one or more providers.
If you want to make sure that the package is not changing server side settings the best approach you can take is to use the API but make the packages be deployed via Web Management Service. This will give you two benefits:
You can control what providers you allow through.
You can add users and give restricted permissions to them to deploy to their site or their folder etc.
The alternate approach is to:
In the package manually look at the archive.xml and look for the providers in the package. As long as you dont see any of the following providers that can cause server settings change such as apphostconfig or webserver or regkey (this is not a comprehensive list) you should be good. Runcommand is a provider that allows you to execute batch scripts or commands. While it is a good provider for admins themselves you need to consider whether you want to allow packages with such providers to run.
You can do the above mentioned inspection in code by calling getchildren on the deployment object you create out of the package and inspect the providers and the provider paths.

Related

NServiceBus endpoint is not starting on Azure Service Fabric local cluster

I have a .NetCore stateless WebAPI service running inside Service Fabric local cluster.
return Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();
When I'm trying to start NServiceBus endpoint, I'm getting this exception :
Access to the path 'C:\SfDevCluster\Data_App_Node_0\AppType_App10\App.APIPkg.Code.1.0.0.diagnostics' is denied.
How can it be solved ? VS is running under administrator.
The issue you are having is because the folder you are trying to write to is not supposed to be written by your application.
The package folder is used to store you application binaries and can be recreated dynamically whenever an application is hosted in the node.
Also, the binaries are reused by multiple service instances running on same node, so it might compete to use the files by different instances.
You should instead instruct your application to write to the WorkFolder,
public Stateless1(StatelessServiceContext context): base(context)
{
string workdir = context.CodePackageActivationContext.WorkDirectory;
}
The code above will give you a path like this:
'C:\SfDevCluster\Data_App_Node_0\AppType_App10\App.APIPkg.Code.1.0.0.diagnostics\work'
This folder is dynamic, will change depending on the node or instance of your application is running, when created, your application should already have permission to write to it.
For more info, see:
how-do-i-get-files-into-the-work-directory-of-a-stateless-service?forum=AzureServiceFabric
Open folder properties Security tab
Select ServiceFabricAllowedUsers
Add Write permission

WCF (Dynamics AX) - Service sending most properties null

I'm doing an ASPNet MVC integration with dynamics AX using web services.
We have 3 environments:
DEV
QA (Quality environment)
PROD
We've been developing it for a while on DEV and the services always worked.
Now we are passing it to the Quality Environment (QA, before PROD) and I changed the config to go to QA instead of DEV and we discovered a problem.
There are 2 services that send ~90% of their properties as NULL, the other 10% is ok.
We tried:
- Created console that saves the XML being received from AX.
- Reviewing web config
- Re-adding web services
We discovered that if we just add the service to the project using the QA URL, it works, but if we add it using DEV URL and afterwards change the config to match the QA URL it doesn't work.
So, it's not about the code, but something on the DEV > QA merge of AX, right?
Any ideas?
Fix
I found a fix for this.
I discovered that if the column order is different from server to server (WCF Server) this kind of things will happen.
I fixed it by downloading the WSDL and updating the reference from within Visual Studio.
Downloaded WSDL (Url: http://?singleWsdl)
Saved it to a folder in my pc
Configure the URL in VS (Changed it to the file in my pc instead of the URL)
Update service
It's a bit boring because you have to change this every time you want to compile it for a different environment, but until I find a permanent solution it will work this way.

Endeca-Hybris integration not working

i'am trying to integrate hybris 4.7.9 with endeca. I have installed the following endeca components. 1)MDEX engine 2)Platform services 3)Endeca workbench 4)CAS.
I have deployed a sample application on endeca side using "D:\Endeca\ToolsAndFrameworks\11.0.0\deployment_template\bin\deploy.bat"
In Hyend2 in admincockpit of hybris
I have made EAC/CAS connection with my appication and made a export job.
Problem is i am not able to run that job, it reports me following error:
http://localhost:8500/MyAppen_en_data/?wsdl returned response code 404
at com.endeca.itl.service.ServiceLocator.getService(ServiceLocator.java:150)
I don't know Hybris, but since the error is related to Endeca, let me try to give some pointers.
CAS: Check that CAS is up and running
App Name: You might have specified app-name-with-locale (MyAppen) somewhere where you need to specify only app-name (MyApp). [The Endeca app name without the locale is called as "Base Application Name". Go back and check all your configurations in Hybris and Endeca].
You may also refer to this blog (Although it is for ATG framework, it should give idea for Hybris as well).

Running RavenDB as an EmbeddableDocumentStore and accessing RavenDB Management Studio

I'm playing with an embedded RavenDB => RavenDB-Embedded.1.0.499 package installed via NuGet in Visual Studio 2010. It's being used in a current project that I started after reading this excellent MSDN article:
Embedding RavenDB into an ASP.NET MVC 3 Application
Now I'd like to access the RavenDB Management Studio (Web UI).
I followed the steps described here: Is it possible to connect to an embedded DB with Raven Management Studio and here Running RavenDB in embedded mode with HTTP enabled but I didn't get the point.
This is the code I'm using to initialize the DocumentStore:
_documentStore = new EmbeddableDocumentStore
{
ConnectionStringName = "RavenDB",
UseEmbeddedHttpServer = true
};
and this is the ConnectionString present in Web.config:
<add name="RavenDB" connectionString="DataDir = ~\App_Data\Database" />
I also read the steps described in RavenDB: Embedded Mode. I tried to start the server manually:
// Start the HTTP server manually
var server = new RavenDbHttpServer(documentStore.Configuration,
documentStore.DocumentDatabase);
server.Start();
but the above code seems outdated since I have no RavenDbHttpServer, documentStore.Configuration and documentStore.DocumentDatabase. I managed to find Raven.Database.Server.HttpServer but the other objects are missing in the _documentStore.
So, the question is:
How can I hit the Web UI to visualize my embedded database docs? What's the URL I should put in my browser address bar?
Any advice is appreciated.
EDIT: I've found a way of getting it to work. As I described in my blog post it may not be the best approach but it does work:
RavenDB Embedded with Management Studio UI
Note: one downside of the above approach is that I'm not able to access the database in my app because once it has been opened by the server it gets locked. This way I have to stop the server and then reload my app in the browser.
I hope RavenDB's gurus out there have a better/correct approach... just let us know.
I've never had to run the server manually in order to access the management studio. The only few steps that haven't been mentioned in your question that I usually do:
// Add the following line prior to calling documentStore.Initialize()
Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080);
Copy Raven.Studio.xap into the root folder of my web project.
When my web application is running, the RavenDB Management Studio is then accessible at http://localhost:8080.

DeploymentCatalog security error

I'm trying to use the DeploymentCatalog to load my service implementations by MEF. I have the implementation in a single xap. when I use the following code to download it , every thing is ok :
var catalog = new DeploymentCatalog("MyXap.xap");
catalog.DownloadAsync();
I put my xap on a remote server , say on http://ip:90/Myxap.xap, when I write the same code but with the uri , it throws a deployment exception:
var catalog = new DeploymentCatalog(new Uri("http://ip:90/MyXap.xap",UriKind.Absolute));catalog.DownloadAsync();
Any help .
Thanks in advance ...
If the XAP you are trying to download is hosted at a different domain (or different port, I think) than your Silverlight App is, you will need a cross domain policy file on the site that hosts your XAP to allow your Silverlight App to access it.
If that's not the problem, you'll need to provide more information. Edit your question to include the full text of the deployment exception you get.