developer maker musician

Monday, April 25, 2016

"Use port 80 and 443 for additional incoming connections." - The Skype setting that every developer should disable. Solution to "The process cannot access the file because it is being used by another process" when running a Service Fabric hosted WebApp.

I just flattened my machine and ran into this issue when running a Service Fabric hosted WebAPI project.


This line of code:

this.serverHandle = WebApp.Start(this.listeningAddress, appBuilder => this.startup.Configuration(appBuilder, this.config));


Was throwing this exception:

Message=The process cannot access the file because it is being used by another process


Luckily, I remembered that I ran into this same issue before and didn’t disable this when I rebuilt my machine. By default, Skype uses port 80 and 443. You, as a developer, should disable that. Uncheck this box under Tools—> Options –> Advanced –> Connection: “Use port 80 and 443 for additional incoming connections”.


2016-04-25


Jon

Saturday, April 23, 2016

How to Create a Local Copy of an Azure SQL Database

Here’s what you do when you want to get a local copy of an Azure SQL Database.

Export Azure Database

1. Select your database in the Azure Portal

https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Sql%2Fservers%2Fdatabases

2. Click Export in the Header

image

3. Give it a name, storage, container, etc and start the export.

4. Check on the status of the export here:

https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Sql%2Fservers

5. Select your server and scroll to the bottom and click on Import/Export History

image

Import to Local SQL Server

Once the Export has completed, you now Import it to your local machine. This works with SQL Express too, just install the BOTH x86 and x64 versions of the DAC Framework first: https://www.microsoft.com/en-us/download/details.aspx?id=45886


1. Open SQL Management Studio and Right Click on Databases and Select Import Data-tier Application

image


2. Connect to your Azure Database Export and click Next a couple of times.

image


That should be it. If it fails, make sure you install the DAC Framework as mentioned above.

Jon

Solution: Internal Error. The database platform service with type Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type name of a valid database platform service. (Microsoft.Data.Tools.Schema.Sql)

If you get the following error, then you need to install BOTH x86 and x64 versions of the DAC Framework. I have only verified that this works with SQL Express 2014.

https://www.microsoft.com/en-us/download/details.aspx?id=45886

The other option is to install the 2016 preview tools, but I haven’t tried that.

https://msdn.microsoft.com/en-us/library/mt238290.aspx


image


TITLE: Microsoft SQL Server Management Studio

------------------------------

Could not load schema model from package. (Microsoft.SqlServer.Dac)

------------------------------

ADDITIONAL INFORMATION:

Internal Error. The database platform service with type Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type name of a valid database platform service. (Microsoft.Data.Tools.Schema.Sql)

------------------------------

BUTTONS:

OK

------------------------------

===================================

Could not load schema model from package. (Microsoft.SqlServer.Dac)

------------------------------

Program Location:

at Microsoft.SqlServer.Dac.DacPackage.LoadModel(IPackageSource packageSource, Boolean ignoreUnresolvedExternalErrors)

at Microsoft.SqlServer.Dac.Extensions.DacExtensions.GetCollationString(IPackageSource packageSource)

at Microsoft.SqlServer.Dac.Extensions.DacExtensions.GetCollationString(BacPackage package)

at Microsoft.SqlServer.Management.Dac.DacWizard.CreateDatabaseOnTargetWorkItem.DoWork()

at Microsoft.SqlServer.Management.TaskForms.SimpleWorkItem.Run()

===================================

Internal Error. The database platform service with type Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type name of a valid database platform service. (Microsoft.Data.Tools.Schema.Sql)

------------------------------

Program Location:

at Microsoft.Data.Tools.Schema.Extensibility.ExtensionTypeLoader.InstantiateDatabaseSchemaProvider(String databaseSchemaProviderType)

at Microsoft.Data.Tools.Schema.Extensibility.ExtensionManager.UpdateExtensions()

at Microsoft.Data.Tools.Schema.Extensibility.ExtensionManager..ctor(String databaseSchemaProviderType)

at Microsoft.Data.Tools.Schema.Extensibility.ExtensionManager.GetExtensionManager(String dsp)

at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.DeserializeXml(TextReader input, ErrorManager errors, String source, Action`3 constructorParametersSetter)

at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.DeserializePackage(SqlPackage package, ErrorManager errors, Action`3 constructorParametersSetter)

at Microsoft.SqlServer.Dac.DacPackage.DeserializePackage(SqlPackage package, DacSchemaModelStorageType modelStorageType, ErrorManager errorManager, DataSchemaModelHeader& header)

at Microsoft.SqlServer.Dac.DacPackage.LoadModel(IPackageSource packageSource, Boolean ignoreUnresolvedExternalErrors)

Thursday, April 14, 2016

Brother Printer Troubleshooting Tips

I have a Brother MFC-7840W printer and usually have issues with it. 

Here’s what has helped:

Drivers

1. Install the full driver package from here: http://support.brother.com/g/b/downloadtop.aspx?c=us&lang=en&prod=mfc7840w_all

2. Select your OS, click Search.

image

3. Install the Full Driver Package

image


Network Settings

If you can’t find your printer then it is probably because you haven’t enabled sharing.  The easiest way to do that is to disconnect and reconnect your wifi network.


1. Click on your wifi network icon next to your clock

image

2. Right click on your network and select “Forget this network”

3. Reconnect

image

4. When you get to this option, select Yes

image

Jon

Sunday, April 10, 2016

How to Convert a Stateless Azure Service Fabric Service to a Stateful Service

I built a stateless Azure Service Fabric service and later realized I would need a stateful service. Rather than try to comb through docs to see what the conversion looked like, I created a brand new stateless service and another stateful service and diff’d them. I’m sharing in case someone else needs to do the same.

You can see everything you need to do in this commit: https://github.com/jonbgallant/azure-service-fabric-stateless-to-stateful-conversion/commit/168c42776fbd4d23f5f8d0ebc943a9ee6fe2129f


Or you can follow along below…


MySolution/MyService/MyService.cs

Add Microsoft.ServiceFabric.Data.Collections namespace

image

Derive from StatefulService instead of Stateless service and inject StatefulServiceContext

image

Use ServiceReplicaListener instead of ServiceInstanceListener

image

Use ReliableDictionary/ReliableQueue as needed by your service logic.

image

MySolution/MyService/PackageRoot/Config/Settings.xml

Add ReplicatorConfig section to config

image

MySolution/MyService/PackageRoot/ServiceManifest.xml

Set “HasPersistedState” variable in ServiceManifest

Change StatelessServiceType to StatefulServiceType

image

MySolution/MyService/ServiceEventSource.cs

Inject StatefulService and set ReplicaId instead of InstanceId

image

MySolution/MyServiceFabricApplication/ApplicationPackageRoot/ApplicationManifest.xml

Add Replica settings to ApplicationManifest

Change StatelessService element to StatefulService Element

image

MySolution/MyServiceFabricApplication/ApplicationParameters/Cloud.xml

Add Parameters to your Cloud and Local.xml files

image


MySolution/MyServiceFabricApplication/ApplicationParameters/Local.xml

image


Jon