i've read some articles "http://www.c-sharpcorner.com/UploadFile/40e97e/windows-azu-creating-and-deploying-worker-role/"
if i try to run my code' error occurs:
ERROR: Windows Azure Tools: Failed to initialize the Development Storage service. Unable to start Development Storage
i made some investigation to solve this boring problem:
http://www.nimbo.com/blog/error-failed-to-initialize-windows-azure-storage-emulator/
http://kristofmattei.be/2010/01/28/windows-azure-sdk-connecting-to-non-sqlexpress-instance/
if i run "dsinit /sqlinstance:." if i use :"WAStorageEmulator init –forcecreate" result 's below:
Error: "DsInit can not found"
If you're using Azure SDK 2.3, please note that DSInit.exe has been removed from the SDK. It has been replaced with WAStorageEmulator.exe which can be found in C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator folder.
To initialize storage emulator, the command you will use is:
WAStorageEmulator init -forcecreate
This is similar to DSInit /forceCreate.
There are some other options available as well:
WAStorageEmulator clear table
Removes just the tables from storage emulator.
WAStorageEmulator clear blob
Removes just the blob containers from storage emulator
WAStorageEmulator clear queue
Removes just the queues from storage emulator.
WAStorageEmulator clear all
Removes all tables, queues and blob containers without deleting the database.
I wrote a blog post about it as well where I talked in somewhat more details about this. You can read the blog post here: http://gauravmantri.com/2014/04/04/managing-storage-emulator-in-azure-sdk-version-2-3
I came across this issue when the emulator wouldn't initialise with SQL SERVER installed (it looks for SQLEXPRESS by default). For Microsoft Azure Storage Emulator v5.8 the accepted answer no longer works. I found the solution on the Microsoft site. In summary:
From the console window that opens on starting the emulator you can use the following commands:
If you want to initialise a specific SQL Server Instance
AzureStorageEmulator.exe init /server <SQLServerInstance>
You can also use the following command, which directs the emulator to use the default SQL Server instance
AzureStorageEmulator.exe init /server .
Or, you can use the following command, which reinitializes the database to the default LocalDB instance
AzureStorageEmulator.exe init /forceCreate
Related
I met an issue when using Azure function.
I create a Azure Functions v1(.Net Framework) Http Trigger template in VS. But when I try to run it directly, exceptions thrown.
I am using latest version of VS(15.6.7) and Azure Functions and Web Job tools(15.0.40502.0).
When I run it first time, no prompt for installation of anything, it runs on 1.0.10 Azure Function CLI. After I restart my VS and try to run it again, VS asks to download 1.0.12.1 Function CLI. The download seems failed as I still see 1.0.10 on the tile of window. The exception remains all the time.
Any idea? It doesn't make sense since I just try to run a template.
The root cause is shown in your screenshot.
Starting Host(...,Version=1.0.11232.0)
It means your function Cli is 1.0.4 other than 1.0.10 actually, here's release note of 1.0.4. After tests, find that old version does cause this exception. This version issue roots in failing to download latest Azure Function Core Tools trough VS.
Update for official solution
Handle downloading problem of Azure Function Core Tools. Try the first option to download using VS again, if it still fails, use the second option, PS scripts.
Below is the original solution, similar to the first and third official option, just ignore it
More Details
Azure Functions and Web Jobs Tools is updated to 15.0.40502.0 recently and mechanism of using local function Cli is also changed. Release Notes.
Tools now consume a feed which keeps templates, build tools, and the runtime up to date whenever there is a change made in the service.
The first time we create an Azure function after this update, we can see the tip on the dialog Making sure all templates are up to date.... It means VS is downloading necessary cli and templates to this folder C:\Users\UserName\AppData\Local\AzureFunctionsTools.
After a while, we can see the tip changes as
If we don't wait the downloading to complete and create project directly, it will prompt that VS is downloading 1.0.12.1 Cli. And everything should work fine after that.
As for your problem, I reproduce it once due to slow network. It fails to download those files and tries to use old version cli downloaded by VS before.
Solution
I recommend you to delete AzureFunctionsTools folder and restart your VS to download it again.
If it still fails to download, you can download it manually.
You can find download link of cli, itemTemplates and projectTemplates in C:\Users\UserName\AppData\Local\AzureFunctionsTools\feed.json.
And the folder structure in C:\Users\UserName\AppData\Local\AzureFunctionsTools\Releases\1.0.12.1 is like this
cli
--func.exe
....
templates
--ItemTemplates.nupkg
--ProjectTemplates.nupkg
manifest.json
Content of manifest.json
{
"ReleaseName": "1.0.12.1",
"CliEntrypointPath":"C:\\Users\\UserName\\AppData\\Local\\AzureFunctionsTools\\Releases\\1.0.12.1\\cli\\func.exe",
"TemplatesDirectory": "C:\\Users\\UserName\\AppData\\Local\\AzureFunctionsTools\\Releases\\1.0.12.1\\templates",
"FunctionsExtensionVersion": "~1",
"SdkPackageVersion": "1.0.13"
}
I've upgraded Azure Storage Emulator from 2.3 to 2.4. WAStorageEmulator.exe has been renamed to AzureStorageEmulator.exe but that's not the issue.
When I run
AzureStorageEmulator init -forcecreate
I simply get an error that Google returns with zero results:
Error: User-specified instance not found. Please correct this and re-run initial
ization.
Edit
I had to do a start and stop and then I was able to init. Because I had previous version of emulator installed I already have WAStorageEmulatorDb34 on my local SQL server instance. After I run init command I can see that no new database is being created (like WAStorageEmulatorDb42).
So I thought that the newest version may be using older DB. I then ran a query in MSSMS to check for existing blob containers and I can still see both containers I created on the older emulator containing blobs I added.
When I then accessed Development Azure Storage in Visual Studio it showed no containers whatsoever. So the new version apparently doesn't use old DB. But which one? And where is it?
Ok so I thought I'd run init one more time but with additional parameters to put DB on my SQL server instance:
AzureStorageEmulator init -server localhost -sqlinstance MSSQLSERVER -forcecreate
And then I get the aforementioned error. Again...
I'm running CMD as admin with elevated permissions.
Solution that eventually worked
Additional info
Azure Storage Emulator normally creates tables in the LocalDB storage. Depending on the emulator version these may be in various DB instances. You can check each storage emulator version's configuration in
%USERPROFILE%\AppData\Local\[AzureStorageEmulatorFolder]\*.config
Different versions have different folder names from DevelopmentStorage, WAStorageEmulator to latest (4.2) AzureStorageEmulator.
In this subfolder you'll find at least one config file that will correspond to your installed Azure storage emulator's version. If you open it, you'll see how it's configured and where it saved its tables. This is also true if you create initialization on any existing full SQL server instance.
The problem when I was trying to initialize my Azure Storage Emulator (ASE) is that I was also providing SQL server's instance which is the default one (MSSQLSERVER). I shouldn't be providing this information in the first place but only provide information about server
So the correct command line call is
AzureStorageEmulator init -server localhost -forcecreate
This created my database on my local SQL server. From here on, it's up to you how you'll migrate from an existing ASE database (if you already had one before) to the new one.
The issue I ran into is more or less an user error.
Azure Storage Emulator 4.6
Error : User-specified instance not found. Please correct this and
re-run initialization.
and
Resolution : I didn't have a windows authenticated login to my local
sql instance.
I am trying to start the Azure storage emulator, to no avail.
Init runs fine, but start does not, and I want to have a look at the logs to find out why.
Where are these log files stored?
Thanks
The Azure storage emulator log is stored in C:\Users\xxx\AppData\Local\Microsoft\CLR_v4.0\UsageLogs\WAStorageEmulator.exe.log
In my case, I have "some" logs here: C:\Users\<YOUR_WINDOWS_USER_NAME>\AppData\Local\Microsoft\CLR_v4.0\UsageLogs\AzureStorageEmulator.exe.log
You might as well look at this document here
. It shows how to enable the logs. Basically it says:
Head to the Storage Emulator data directory, which is located at
%LOCALAPPDATA%\DevelopmentStorage.
(Actually in my case it is in %LOCALAPPDATA%\AzureStorageEmulator)
Edit the the developmentstorage configuration file located in the directory and change the LoggingEnabled to true
Restart Storage Emulator
The logs will appear in the logs directory.
This turned out to be a result of running a bittorrent client before I tried to start the emulator.
Turn the bittorrent client off, turn the emulator on, and then then turn the bittorent client back on, solves the problem.
I am trying to deploy a Cloud Service with 1 Web Role to Azure.
When I do so, I get this message:
Your role instances have recycled a number of times during an update or upgrade operation. This indicates that the new version of your service or the configuration settings you provided when configuring the service prevent the role instances from running. Verify your code does not throw unhandled exceptions and that your configuration settings are correct and then start another update or upgrade operation.
The project runs just fine locally, and I'm having a hard time figuring out how to start debugging this issue. Are there any common problems that cause this message or steps to figure out what is causing it?
See https://learn.microsoft.com/en-us/archive/blogs/kwill/windows-azure-paas-compute-diagnostics-data. This will walk through all of the diagnostic data available as well as how to troubleshoot the most common issues.
We also had this annoying problem and in our case:
We use local storage, but it wasn't defined in service definition (or Worker Role's properties)
Our worker role project has reference to a service project which has reference to data layer project. But, the worker role project doesn't have reference to the data layer project. As soon as we added reference to data layer project in worker role project, it deploys successfully.
Problem #1 can be easily noticed if you first run the project in your local machine. Exception will be thrown.
Problem #2, however, is more difficult, mainly because it runs just fine in local machine. After 5 days of trouble shooting, we finally found the problem. So, check all references and try to add sub-reference projects, those that are referenced by other references.
We had similar problem, and it was due to some DDLs failed to load. (due to different version from the one MS have deployed to the VM)
Try to set CopyLocal to "true" for all the References in the project, and re-deploy.
I would either remote desktop to the cloud instance and review the Windows Event Logs for exceptions or redeploy with IntelliTrace Enabled. If you choose the later, you can download the IntelliTrace logs from Visual Studio and debug
http://msdn.microsoft.com/en-us/library/windowsazure/ff683671.aspx
One way to find out the actual error is to click on the " 1 instance" at the top of Dashboard after trying to deploy your web role. It will tell you the status of the role instance. The status should include more information about the type of error which blocks your deployment.
It depends on what your case is. For me, the status claimed that I had an unhandled Security exception. After some investigation, it turned out that under my role's OnStart(), I tried to create a event source. However, Azure service doesn't have the permission to create an event source.
For more possible issues, check http://blogs.msdn.com/b/kwill/archive/2013/09/06/troubleshooting-scenario-3-role-stuck-in-busy.aspx
For me, the issue was with my SQL Azure DB firewall rules. My Azure SQL Database servers are not set to "Allow Access to Azure services", so I have to explicitly list IPs that are allowed.
I discovered this after wrapping my code in a try/catch that swallowed all exceptions, refactoring my OnStart() and RunAsync() methods, and setting all my references to Copy Local = True. None of that worked, then I saw that I had this line in my RunAsync() method:
log4net.Config.XmlConfigurator.Configure();
I am using the AdoNetAdapter for log4net and connecting to an Azure SQL DB for logging, so that led me to check the firewall rules.
For me, I had some differing version of nuget packages in my various projects. Once I consolidated everything to the same version(s), it worked fine.
With the release of Windows Azure SDK version 2.2 for Visual Studio 2012 and 2013, Now you can Remote Debug Cloud Resources within Visual Studio.
Once your cloud service is published and running live in the cloud, you can simply set a breakpoint in your local source code. This may help you in digging out what's going wrong!
How can I locally test the RoleEnvironment.Changing event using the Azure SDK 1.7? Which file do I have to change and do I have to run any other command after that file is changed?
The information on this thread is not very complete and it doesn't work on 1.7 anymore.
After trial and error I discovered that the problem was the wrong cscfg. To test it:
Change the ServiceConfiguration.Local.cscfg from the Azure project
Open the Windows Azure SDK Environment as an Administrator
Change the Directory (cd) to the Azure project where the ServiceConfiguration.Local.cscfg file is located
run the command csrun /update:[DEPLOYMENT ID];ServiceConfiguration.Local.cscfg where [DEPLOYMENT ID] is the number in parenthesis following the label deployment (XX) of the Azure Emulator
Also I noticed that the csrun /update:[DEPLOYMENT ID];ServiceConfiguration.Local.cscfg will terminate the deployment if we are debugging the solution (Start Debugging - F5), it will work normally only with (Start without Debugging - Ctrl F5) option.
Added just in case it helps anyone.