无法初始化/运行Azure存储模拟器

时间:2019-03-13 22:55:26

标签: azure azure-storage azure-functions azure-storage-emulator

无法初始化/运行Azure存储模拟器

我试图创建一个Azure函数,并且从一开始就遇到问题。我有VS 2017 Enterprise,我创建了一个模板Azure函数,当我去调试时,它让我知道典型的(解释为)``无法启动Azure Storage Emulator,请以管理员身份运行azurestorageemulator.exe启动。我是通过以管理员身份运行VSStudio的,并且结果正常。

(顺便说一句,当我昨天最初开始时,我在模拟器5.4.xx上……经历了我能找到的一切,包括删除/重新启动localdb实例……然后有一个有趣的观点在这里,我决定更新Visual Studio和所有组件,然后执行一次重新启动,然后打开VS模板项目并运行调试,它开始工作,模拟器命令窗口打开并运行,并显示所有预期的输出,等等。 。我关了一个晚上,但是第二天又回来了,现在我回到了原来的问题状态。)

所以我去做(从第一段开始,以管理员身份运行存储模拟器),然后基本上得到一个错误探测(localdb)/ MSSQLLocalDB(完整的错误日志将在底部):

探测SQL实例:“(localdb)\ MSSQLLocalDB”。 探索SQL端点时捕获到异常。目标主体名称不正确。无法生成SSPI上下文。

总结的错误是应该运行init,尽管我认为问题首先是访问本地数据库的一个问题……但我还是尝试init并遇到类似的问题:

我已完成删除mssqllocaldb和azurestorageemulator mdf以及类似文件的步骤,这些步骤按预期进行,没有问题...这是该数据库的当前详细信息:


C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>sqllocaldb i
MSSQLLocalDB
v11.0

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>sqllocaldb i "MSSQLLocalDB"
Name:               MSSQLLocalDB
Version:            13.1.4001.0
Shared name:
Owner:              {MyComputer'sName, replaced actual value here}\{MyUserProfile, replaced actual value}
Auto-create:        Yes
State:              Running
Last start time:    3/13/2019 3:38:36 PM
Instance pipe name: np:\\.\pipe\LOCALDB#B161531A\tsql\query

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>

这是模拟器启动/初始化调用的完整输出。任何帮助或想法将不胜感激!


C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe start
Windows Azure Storage Emulator 5.7.0.0 command line tool
Autodetect requested. Autodetecting SQL Instance to use.
Looking for a LocalDB Installation.
Probing SQL Instance: '(localdb)\MSSQLLocalDB'.
Caught exception while probing for SQL endpoint. The target principal name is incorrect.  Cannot generate SSPI context.
Number of SqlErrors Reported: 1
SqlError: System.Data.SqlClient.SqlError: The target principal name is incorrect.  Cannot generate SSPI context.
Could not find a LocalDB Installation.
Probing SQL Instance: 'localhost\SQLExpress'.
Caught exception while probing for SQL endpoint. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Number of SqlErrors Reported: 1
SqlError: System.Data.SqlClient.SqlError: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
No available SQL Instance was found.
One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again.
Error: The storage emulator needs to be initialized. Please run the 'init' command.

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe init
Windows Azure Storage Emulator 5.7.0.0 command line tool
Empty SQL Instance. Autodetecting SQL Instance to use.
Looking for a LocalDB Installation.
Probing SQL Instance: '(localdb)\MSSQLLocalDB'.
Caught exception while probing for SQL endpoint. The target principal name is incorrect.  Cannot generate SSPI context.
Number of SqlErrors Reported: 1
SqlError: System.Data.SqlClient.SqlError: The target principal name is incorrect.  Cannot generate SSPI context.
Could not find a LocalDB Installation.
Probing SQL Instance: 'localhost\SQLExpress'.
Caught exception while probing for SQL endpoint. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Number of SqlErrors Reported: 1
SqlError: System.Data.SqlClient.SqlError: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
No available SQL Instance was found.
One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again.
Error: No available SQL Instance was found.

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>

如果有用,这是完整的AzureStorageEmulator.exe.config文件:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="StorageEmulatorConfig" type="Microsoft.WindowsAzure.Storage.Emulator.Controller.Configuration.StorageEmulatorConfigurationHandler, Microsoft.Azure.Storage.Emulator.Controller"/>
  </configSections>

  <StorageEmulatorConfig>
    <services>
      <service name="Blob" url="http://127.0.0.1:10000/"/>
      <service name="Queue" url="http://127.0.0.1:10001/"/>
      <service name="Table" url="http://127.0.0.1:10002/"/>
    </services>

    <!-- NOTE: These are preconfigured accounts with well known keys. The purpose of the
      authentication supported by the Storage Emulator is simply to allow you to test
      your authentication code. It has no security purpose.
      It is strongly recommended that you DO NOT use your actual storage account or key over here.
      These keys are stored unencrypted on disk and in SQL databases.
      -->
    <accounts>
      <account name="devstoreaccount1" authKey="{ActualValueRemoved}" />
    </accounts>
  </StorageEmulatorConfig>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Windows.Forms" publicKeyToken="b77a5c561934e089" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Core" publicKeyToken="b77a5c561934e089" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Xml" publicKeyToken="b77a5c561934e089" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="mscorlib" publicKeyToken="b77a5c561934e089" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System" publicKeyToken="b77a5c561934e089" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Drawing" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Runtime.Serialization" publicKeyToken="b77a5c561934e089" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="System.Data.Services" publicKeyToken="b77a5c561934e089" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Data" publicKeyToken="b77a5c561934e089" culture="neutral"/>
        <bindingRedirect oldVersion="2.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

此外,这是AppData \ Local \ AzureStorageEmulator \ AzureStorageEmulator.5.7.config中配置文件的内容:

<?xml version="1.0"?>
<StorageEmulator xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SQLInstance />
  <PageBlobRoot>C:\Users\{I STRIPPED OUT MY USER PROFILE NAME}\AppData\Local\AzureStorageEmulator\PageBlobRoot</PageBlobRoot>
  <BlockBlobRoot>C:\Users\{I STRIPPED OUT MY USER PROFILE NAME}\AppData\Local\AzureStorageEmulator\BlockBlobRoot</BlockBlobRoot>
  <LogPath>C:\Users\{I STRIPPED OUT MY USER PROFILE NAME}\AppData\Local\AzureStorageEmulator\Logs</LogPath>
  <LoggingEnabled>false</LoggingEnabled>
</StorageEmulator>

0 个答案:

没有答案