1

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

我正在尝试创建一个 Azure 函数,并在一开始就遇到问题。我有 VS 2017 企业版,我创建了一个模板 Azure 函数,当我去调试时,它让我知道典型的(释义)'无法启动 Azure 存储模拟器,请以管理员身份运行 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>
4

0 回答 0