Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default template ServiceBusTopicTrigger - C# doesnt work #119

Closed
mnbf9rca opened this issue Dec 23, 2016 · 3 comments
Closed

default template ServiceBusTopicTrigger - C# doesnt work #119

mnbf9rca opened this issue Dec 23, 2016 · 3 comments

Comments

@mnbf9rca
Copy link

I created a new functions app in VS2015 using the instructions here:

https://blogs.msdn.microsoft.com/webdev/2016/12/01/visual-studio-tools-for-azure-functions/

I selected "ServiceBusTopicTrigger - C#" as the template, and populated it with the relevant details (topic name, subscription name, SB connection string). I selected a meaningful name for the function. I haven't changed anything else. When I run the function, I get this error:

Listening on http://localhost:7071/
Hit CTRL-C to exit...
Reading host configuration file 'C:\Users\mnbf9rca\OneDrive\vs\owncode\FunctionApp2\FunctionApp2\host.json'
Generating 1 job function(s)
Starting Host (HostId=lonbs-l-98759-functionapp2, Version=1.0.0.0, ProcessId=6132, Debug=False)
A ScriptHost error has occurred
Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.process-evohome-data'. Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string 'AzureWebJobsEndpoint=sb://<host>.servicebus.windows.net/;SharedAccessKeyName=functions-access;SharedAccessKey=<key>' is missing or empty.Error indexing method 'Functions.process-evohome-data'
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.).
Job host started
The following 1 functions are in error:
process-evohome-data: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.process-evohome-data'. Microsoft.Azure.WebJobs.ServiceBus: Microsoft AzureWebJobs SDK ServiceBus connection string 'AzureWebJobsEndpoint=sb://<host>.servicebus.windows.net/;SharedAccessKeyName=functions-access;SharedAccessKey=<key>' is missing or empty.

File change of type 'Changed' detected for 'C:\Users\mnbf9rca\OneDrive\vs\owncode\FunctionApp2\FunctionApp2\data\functions\sampledata'
Host configuration has changed. Signaling restart.
Stopping Host
Job host stopped
Reading host configuration file 'C:\Users\mnbf9rca\OneDrive\vs\owncode\FunctionApp2\FunctionApp2\host.json'
Debugger listening on [::]:5858
Generating 1 job function(s)
Starting Host (HostId=lonbs-l-98759-functionapp2, Version=1.0.0.0, ProcessId=6132, Debug=True)
A ScriptHost error has occurred
Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.process-evohome-data'. Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string 'AzureWebJobsEndpoint=sb://<host>.servicebus.windows.net/;SharedAccessKeyName=functions-access;SharedAccessKey=<key>' is missing or empty.
Error indexing method 'Functions.process-evohome-data'
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.).
Job host started
The following 1 functions are in error:
process-evohome-data: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.process-evohome-data'. Microsoft.Azure.WebJobs.ServiceBus: Microsoft AzureWebJobs SDK ServiceBus connection string 'AzureWebJobsEndpoint=sb://<host>.servicebus.windows.net/;SharedAccessKeyName=functions-access;SharedAccessKey=<key>' is missing or empty.

function.json looks like this:

{
  "disabled": false,
  "bindings": [
    {
      "name": "mySbMsg",
      "type": "serviceBusTrigger",
      "direction": "in",
      "topicName": "evohome-data",
      "subscriptionName": "test-functions",
      "connection": "Endpoint=sb://<host>.servicebus.windows.net/;SharedAccessKeyName=functions-access;SharedAccessKey=<key>",
      "accessRights": "Manage"
    }
  ]
}

and run.csx looks like this:

using System;
using System.Threading.Tasks;

public static void Run(string mySbMsg, TraceWriter log)
{
    log.Info($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
    
}

I'm on Windows 7 64bit using VS2015 U3. Here are the versions:

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01590

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA469
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Microsoft Visual Studio Tools for Applications 2015   00322-80000-00000-AA469
Microsoft Visual Studio Tools for Applications 2015

Visual Basic 2015   00322-80000-00000-AA469
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA469
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA469
Microsoft Visual C++ 2015

ASP.NET and Web Tools 2015.1   14.1.21111.0
ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Azure App Service Tools v2.9.6   14.0.21205.0
Azure App Service Tools v2.9.6

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.2.2100.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Logic Apps Tools for Visual Studio   1.0
Add-in for the Azure Resource Group project to support the Logic App Designer and template creation.

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

CS-Script for VS2012   1.0
CS-Script tools for VS2012

GitHub.VisualStudio   2.1.1.5
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft Azure Hive Query Language Service   2.2.2100.0
Language service for Hive query

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.9.41104.6

NuGet Package Manager   3.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Python Tools for Visual Studio   2.2.40825.00
Python Tools for Visual Studio provides IntelliSense, projects, templates, Interactive windows, and other support for Python developers.

Python Tools for Visual Studio - Django Integration   2.2.40825.00
Provides templates and integration for the Django web framework.

Python Tools for Visual Studio - Profiling Support   2.2.40825.00
Profiling support for Python projects.

SQL Server Analysis Services   13.0.1700.281
Microsoft SQL Server Analysis Services Designer 
Version 13.0.1700.281

SQL Server Data Tools   14.0.60923.0
Microsoft SQL Server Data Tools

SQL Server Integration Services   
Microsoft SQL Server Integration Services Designer
Version 13.0.1601.5

SQL Server Reporting Services   13.0.1700.281
Microsoft SQL Server Reporting Services Designers 
Version 13.0.1700.281

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript   1.8.36.0
TypeScript tools for Visual Studio
@lindydonna
Copy link
Contributor

You can't use a service bus connection string directly in function.json. You need to add a connection string name, and set the value in AppSettings.json.

@mnbf9rca
Copy link
Author

mnbf9rca commented Jan 5, 2017

Yeah, I discovered that. When you create the same function using the same template directly in the function app on the website, it automatically creates application.json and creates the reference for you - however when using the template within visual studio there is no application.json by default, and it doesn't automatically create the reference.

@lindydonna
Copy link
Contributor

Closed as it's more of an error message issue, which is tracked by Azure/azure-functions-core-tools#38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants