Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure函数错误索引方法-远程调试器崩溃_Azure_Azure Functions_Remote Debugging - Fatal编程技术网

Azure函数错误索引方法-远程调试器崩溃

Azure函数错误索引方法-远程调试器崩溃,azure,azure-functions,remote-debugging,Azure,Azure Functions,Remote Debugging,我有一个azure function应用程序,所有东西都在本地工作。我可以将应用程序成功发布到azure,但所有端点都返回500个服务器错误 我的主机日志如下所示: 2018-09-17T15:05:14.801 [Information] Host Status: { "id": "---function", "state": "Default", "version": "2.0.12095.0", "versionDetails": "2.0.12095.0-rc1 Comm

我有一个azure function应用程序,所有东西都在本地工作。我可以将应用程序成功发布到azure,但所有端点都返回500个服务器错误

我的主机日志如下所示:

2018-09-17T15:05:14.801 [Information] Host Status: {
  "id": "---function",
  "state": "Default",
  "version": "2.0.12095.0",
  "versionDetails": "2.0.12095.0-rc1 Commit hash: beb6b6afde701a57----c051c082e2d1c738e18"
}
2018-09-17T15:05:16.555 [Information] Generating 11 job function(s)
2018-09-17T15:05:16.576 [Error] Error indexing method 'AddMaterial.Run'
2018-09-17T15:05:16.657 [Warning] Function 'AddMaterial.Run' failed indexing and will be disabled.
2018-09-17T15:05:16.658 [Error] Error indexing method 'ChangeMaterialWeight.Run'
2018-09-17T15:05:16.714 [Warning] Function 'ChangeMaterialWeight.Run' failed indexing and will be disabled.
2018-09-17T15:05:16.766 [Error] Error indexing method 'CheckIfOldestMaterial.Run'
2018-09-17T15:05:16.863 [Warning] Function 'CheckIfOldestMaterial.Run' failed indexing and will be disabled.
2018-09-17T15:05:16.864 [Error] Error indexing method 'CreateBoxType.Run'
2018-09-17T15:05:16.915 [Warning] Function 'CreateBoxType.Run' failed indexing and will be disabled.
2018-09-17T15:05:16.916 [Error] Error indexing method 'CreateFinishedGoods.Run'
2018-09-17T15:05:16.961 [Warning] Function 'CreateFinishedGoods.Run' failed indexing and will be disabled.
2018-09-17T15:05:16.962 [Error] Error indexing method 'CreateWarehouse.Run'
2018-09-17T15:05:17.005 [Warning] Function 'CreateWarehouse.Run' failed indexing and will be disabled.
2018-09-17T15:05:17.006 [Error] Error indexing method 'WarehousesAll.Run'
2018-09-17T15:05:17.053 [Warning] Function 'WarehousesAll.Run' failed indexing and will be disabled.
2018-09-17T15:05:17.054 [Error] Error indexing method 'MaterialByRollId.Run'
2018-09-17T15:05:17.115 [Warning] Function 'MaterialByRollId.Run' failed indexing and will be disabled.
2018-09-17T15:05:17.116 [Error] Error indexing method 'MaterialsByMaterialNumber.Run'
2018-09-17T15:05:17.177 [Warning] Function 'MaterialsByMaterialNumber.Run' failed indexing and will be disabled.
2018-09-17T15:05:17.178 [Error] Error indexing method 'MoveFinishedGoods.Run'
2018-09-17T15:05:17.220 [Warning] Function 'MoveFinishedGoods.Run' failed indexing and will be disabled.
2018-09-17T15:05:17.220 [Error] Error indexing method 'MoveMaterial.Run'
2018-09-17T15:05:17.256 [Warning] Function 'MoveMaterial.Run' failed indexing and will be disabled.
2018-09-17T15:05:17.258 [Warning] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
2018-09-17T15:05:17.258 [Information] Host initialized (2497ms)
2018-09-17T15:05:17.262 [Information] Host started (2501ms)
2018-09-17T15:05:17.266 [Information] Job host started
2018-09-17T15:05:22.298 [Information] Host lock lease acquired by instance ID '130a20de31f46----dc65791c3078124'.
我的存储连接字符串与local.settings.json中的其他设置一起填充到azure portal appsettings中

我还尝试在azure门户的connection strings区域填充所有连接字符串,因为我已经阅读了local.settings.json应该只在本地使用

我使用类似于
Environment.GetEnvironmentVariable(“ReadDbConnectionDev”)的代码访问这些设置和连接字符串

编辑:已确认连接字符串不是问题所在,因为我使用了一个没有自定义绑定的新函数进行了测试,该函数能够在部署中正确记录所有连接字符串。这里的问题似乎在于自定义绑定

我有一个azure sql数据存储和一个连接到的cosmos db mongo数据存储。我没有在函数中使用cosmosdb绑定相反,我使用一个带有自定义绑定的存储库模式来连接到它。同样,这可以在本地工作,我已经询问过这是否可以工作

我正在使用WebJobsStartUp和扩展

[assembly: WebJobsStartup(typeof(FunctionStartUp), name: "ESPI Function Startup Extension")]
namespace ESPIWarehouseFunction
{
    public class FunctionStartUp : IWebJobsStartup
    {
        public void Configure(IWebJobsBuilder builder)
        {
            //Don't need to create a new service collection just use the built-in one
            builder.Services.AddSingleton<IQueryService, QueryService>();
            builder.Services.AddSingleton<IWarehouseStateRepository, WarehouseStateRepository>();
            builder.Services.AddSingleton<IMaterialRepository, MaterialRepository>();
            builder.Services.AddSingleton<IEventRepository, EventRepository>();
            builder.Services.AddSingleton<IBoxRepository, BoxRepository>();
            builder.Services.AddSingleton<IReadContext, ReadContext>();
            builder.Services.AddSingleton<IStateContext, StateContext>();
            builder.Services.AddSingleton<IStateContext, StateContext>();
            builder.Services.AddSingleton<IEventStoreContext, EventStoreContext>();
            builder.Services.AddMediatR(typeof(FunctionStartUp).GetTypeInfo().Assembly);

            //Registering an extension
            builder.AddExtension<InjectConfiguration>();
        }
    }
}


namespace ESPIWarehouseFunction.Injection
{
    public class InjectConfiguration : IExtensionConfigProvider
    {
        private IServiceProvider _serviceProvider;

        public InjectConfiguration(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
        }

        public void Initialize(ExtensionConfigContext context)
        {
            var services = new ServiceCollection();
            RegisterServices(services);
            _serviceProvider = services.BuildServiceProvider(true);

            context
                .AddBindingRule<InjectAttribute>()
                .BindToInput<dynamic>(i => _serviceProvider.GetRequiredService(i.Type));
        }
        private void RegisterServices(IServiceCollection services)
        {
            services.AddSingleton<IWarehouseStateRepository, WarehouseStateRepository>();
            services.AddSingleton<IQueryService, QueryService>();
            services.AddSingleton<IMaterialRepository, MaterialRepository>();
            services.AddSingleton<IEventRepository, EventRepository>();
            services.AddSingleton<IBoxRepository, BoxRepository>();
            services.AddSingleton<IReadContext, ReadContext>();
            services.AddSingleton<IStateContext, StateContext>();
            services.AddSingleton<IStateContext, StateContext>();
            services.AddSingleton<IEventStoreContext, EventStoreContext>();
            services.AddMediatR(typeof(InjectConfiguration));
        }
    }
}
[程序集:WebJobsStartup(typeof(FunctionStartUp),name:“ESPI Function Startup Extension”)]
命名空间espiwarehouse函数
{
公共类函数启动:IWebJobsStartup
{
公共void配置(IWebJobsBuilder生成器)
{
//不需要创建新的服务集合,只需使用内置的服务集合即可
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddMediatR(typeof(FunctionStartUp.GetTypeInfo().Assembly);
//注册分机
builder.AddExtension();
}
}
}
命名空间ESPIWarehouseFunction.Injection
{
公共类配置:IExtensionConfigProvider
{
私人IServiceProvider_服务提供商;
公共配置(IServiceProvider服务提供程序)
{
_服务提供者=服务提供者;
}
公共void初始化(ExtensionConfigContext上下文)
{
var services=newservicecolection();
注册服务(服务);
_serviceProvider=services.BuildServiceProvider(true);
上下文
.AddBindingRule()
.BindToInput(i=>_serviceProvider.GetRequiredService(i.Type));
}
专用无效注册表服务(IServiceCollection服务)
{
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
AddMediatR(typeof(InjectConfiguration));
}
}
}
我正在使用azure function web作业工具的最新15.10.2009版本和Microsoft.NET.Sdk.Fuctions的1.0.21

将调试器附加到远程函数时,我的visual studio将冻结,并且我设置的断点表示无法到达
断点


有人知道这里发生了什么吗

因此,问题与未能将extensions.json文件写入远程主机的错误有关。我在最新的sdk v1.0.19和1.0.21中体验到了这一点

这似乎在跟踪它


我可以通过使用云资源管理器将本地extensions.json文件复制到主机上来解决此问题。

关于如何远程调试azure函数,请参考此内容。@TomSun遵循了手动附加过程,虽然不再冻结,但仍无法到达断点。谢谢