I've just got this Google Sample Project to work on my VS2015,
However, after I published to "IIS" and host it, when I opened the link, the web page kept showing this message as the picture showed
I added the key to the web.config, but still doesn't work, just wondering if anyone had done this before, I really need help, thank you!
Edit: Here is my code
Web.Config
<appSettings>
<!-- Set to your Google project id as shown on the Google Developers Console -->
<add key="GoogleCloudSamples:ProjectId" value="gdtest-1332" />
<add key="GOOGLE_APPLICATION_CREDENTIALS" value="D:\ProjectCloud\gdtest-12323.json" />
<!--
Set to either mysql or datastore.
If using mysql, update the connectionString far below, and then run Update-Database in the
Package Manager Console.
-->
<add key="GoogleCloudSamples:BookStore" value="datastore" />
<!-- Set to your Google Cloud Storage bucket -->
<add key="GoogleCloudSamples:BucketName" value="cloudstoragetestbillez" />
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
Programmatically set an environment variable at runtime as such:
string credential_path = #"C:\..\key.json";
System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", credential_path);
I'm not an expert with IIS but it won't seem to pick up on environment variable set in your desktop environment.
Restarting the Visual Studio 2017 did it for me for Console Application.
Console.WriteLine(System.Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS"));
From google documention it seems it is env var and not web.config.
If you are using a service account credential, set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path to the JSON credential file you downloaded.
With command prompt:
set GOOGLE_APPLICATION_CREDENTIALS=[PATH_JSON]
You donĀ“t need setting credentials on code
Google says:
After creating a service account, you have two choices for providing the credentials to your application. You can either set the GOOGLE_APPLICATION_CREDENTIALS environment variable explicitly, or you can pass the path to the service account key in code.
Related
I am trying to embed power BI Dash Board report into Web application.
1) I have configured the application using this Microsoft link and their sample application from github https://learn.microsoft.com/en-us/power-bi/developer/embed-sample-for-your-organization.
2) I have also tried configuring using this documentation https://bitbucket.org/omnistream/powerbi-api-example\
I am accessing the end point with my company email id /password . below is the details. i have admin rights on dash board report and I have power BI pro user account.
Post End point: https://login.microsoftonline.com/common/oauth2/token
Request Header :
User-Agent: Fiddler
Host: login.windows.net
content-Type: application/x-www-form-urlencoded
Content-Length: xxx
with request body :
grant_type=password&scope=openid&username=myUserName#mycompany.com&password=MyPassword&client_id=XXXXX&resource=https://analysis.windows.net/powerbi/api&client_secret=XXXXX
it throws below error:
error_description=AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password
Trace ID: c13c59dc-79e2-4169-bae2-06c402310100
Correlation ID: a747a226-362a-45aa-956a-122629fa9863
Timestamp: 2018-08-06 21:27:59Z
Do i need to configure or create Master Power BI account separately ?
or if my company network interfering with Post request to mask the user id/password, is there any tool which can help me to trace this network issue?
Even after Bypassing the company proxy for credentials it was not working.
finally, I logged the ticket with Microsoft and able make it work for only one of the option i.e. Native application. Below is the step
1) Download 'App owns data ' application from here. And Register your power Bi application in Azure Portal as "Native application" for Application Type. Visit the link #1 in question for details about configuring PowerBI application web page embedding.
2) Open project and import all required Dll using NUget package manager.
3) configure cloud.config with these values in project.
<appSettings>
<add key="authorityUrl" value="https://login.microsoftonline.com/common/oauth2/authorize/" />
<add key="resourceUrl" value="https://analysis.windows.net/powerbi/api" />
<add key="apiUrl" value="https://api.powerbi.com/" />
<add key="embedUrlBase" value="https://app.powerbi.com/v1.0/myorg/" />
</appSettings>
4) Configure your web.config file with these values in project.
<appSettings file="Cloud.config">
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="applicationId" value="xxxxxxx-xxxx-xxxx-xxxx-xxxxxx" /> <!--For PowerBI Native application ID-->
<add key="workspaceId" value="xxxxxxx-xxxx-xxxx-xxxx-xxxxxx" />
<!-- The id of the report to embed. If empty, will use the first report in group -->
<add key="reportId" value="xxxxxxx-xxxx-xxxx-xxxx-xxxxxx" />
<!-- Note: Do NOT leave your credentials on code. Save them in secure place. -->
<add key="pbiUsername" value="XXXXXXXXX#yourcompany.com" />
<add key="pbiPassword" value="xxxxxxxx" />
</appSettings>
5) Publish your report on power BI site , create dash board , fill the report id and work space id in above web.config setting.
6) Execute the application. it should work for Embed report, dashboard and Tile types.
I have been searching all over different sources in search on solving my issue.. I've published a website on IIS that I have been working on and this is my first published website on IIS.
I seem to not be able to connect to the database.
I will provide everything that I have done right down here..
Appreciate any help please....
My web.config file in the published website directory C:\FinancialHubTest.
On a side note I also tried adding User Instance=True to my connection string in my web.config file but it doesn't work..
<connectionStrings>
<!--<add name="ConnStr" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFileName=|DataDirectory|\FinancialHub.mdf;Integrated Security=True" />-->
<add name="ConnStr"
connectionString="Data Source=(LocalDB)\.\IIS_DB;Integrated Security=True;" />
</connectionStrings>
Details of MSSQLLocalDB from cmd
applicationHost file in C:\Windows\System32\inetsrv\config edited with Notepad2.
I'm using FinancialHub as my applicationPool for my published website in IIS
<applicationPools>
<add name="DefaultAppPool" managedRuntimeVersion="v4.0" />
<add name="Classic .NET AppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" />
<add name=".NET v2.0 Classic" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" />
<add name=".NET v2.0" managedRuntimeVersion="v2.0" />
<add name=".NET v4.5 Classic" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" />
<add name=".NET v4.5" managedRuntimeVersion="v4.0" />
<add name="FinancialHub" autoStart="true" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>
<applicationPoolDefaults managedRuntimeVersion="v4.0">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="false" />
</applicationPoolDefaults>
</applicationPools>
My Published Website directory with App_Data having the FinancialHub.mdf file
My SQL Server Object Explorer, the connection only appears when I run my website via Visual Studio 2015 I think that would be running on IIS Express..
I have been getting this error every time I change here and there but I'm really sure why.. Or rather what changes I make to either web.config, etc will cause this error. I check the windows event log too.
I also followed these 2 links on dealing with this issue,
Using LocalDB with Full IIS, Part 1: User Profile,
Using LocalDB with Full IIS, Part 2: Instance Ownership
If there is a need for more information i can provide..
I feel like i have been beating around the bush trying to figure out but i can't seem to solve it..
I really do appreciate any help please. Thank you so much.
You are still using LocalDB even after publishing the application to IIS. LocalDB (SQL Database inside App_Data) is primarily intended for developing and testing purpose only.
You need a real SQL Server when you host the site on IIS. So you need to install SQL Server either in the same server that the application is hosted or a dedicated SQL server. Then attach or copy the existing database to SQL Server.
I'm currently running a WCF service on localhost, with a web.config file that contains credentials to connect to CRM. The web.config file, which is in the root of the project, contains the appSettings as you'd expect:
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="CrmUrl" value="{removed}"/>
<add key="CrmUser" value="{removed}"/>
<add key="CrmPass" value="{removed}"/>
</appSettings>
I then try to retrieve these values with an initialiser
internal CrmOrganizationServiceContext Crm
{
get
{
return CrmConnectionCreator.CreateConnection(
WebConfigurationManager.AppSettings["CrmUrl"],
WebConfigurationManager.AppSettings["CrmUser"],
WebConfigurationManager.AppSettings["CrmPass"]);
}
}
However, null is being passed through to the CreateConnection method. I did a little digging around google, and most suggestions are regarding using WebConfigurationManager, which I currently am doing. Calling WebConfigurationManager.OpenWebConfiguration(null) seems to pass me to a web.config file which exists in the Microsoft.NET framework installation folder, when I'm trying to read in configuration settings from the web.config file in my project.
Is WebConfigurationManager looking in the wrong area, and I have to point it to the right location somehow? I have also tried using plain ConfigurationManager.AppSettings but the results are the same.
i have two different applications, one is a website project running on the the server root, the second is a web application project in a folder, both projects have their configuration files, and i am putting the link in the configuration file of the website project
i am trying to redirect users from the website project to the web application project, whenever i use this:
<add key="CoronaPortalAddress" value="http://localhost/coronaportal/Security/ApplicantSignIn1.aspx?applicationType=" />
<add key="CoronaPortalSignInPage" value="http://localhost/coronaportal/Security/SignIn.aspx" />
<add key="CoronaPortalTimeTablePage" value="http://localhost/coronaportal/Conona Schools_ Trust Council_ApplicantTestScores/TimeTable1.aspx" />
<add key="CoronaPortalResultsPage" value="http://localhost/coronaportal/ParentReportLogin.aspx" />
users will be redirected, though on the url it will showing localhost, so i change it to:
<add key="CoronaPortalAddress" value="http://www.shodsystems.com/coronaportal/Security/ApplicantSignIn1.aspx?applicationType=" />
<add key="CoronaPortalSignInPage" value="http://www.shodsystems.com/coronaportal/Security/SignIn.aspx" />
<add key="CoronaPortalTimeTablePage" value="http://www.shodsystems.com/coronaportal/Conona Schools_ Trust Council_ApplicantTestScores/TimeTable1.aspx" />
<add key="CoronaPortalResultsPage" value="http://www.shodsystems.comcoronaportal/ParentReportLogin.aspx" />
now it throwing error:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS
i tried to google this, but couldnt fix it, any assistance would be appreciated.
I recently installed the latest version of BlogEngine.NET (v3.0). The blog itself renders fine on my browser (i.e., viewing the main page, individual blog posts, etc.) However, when I log in and try to access any of the Admin pages (i.e., Settings, Users, etc.), I am getting an HTTP 403 (Forbidden) error.
This is happening on both Windows Server 2008 R2 x64 as well as Windows Server 2012 x64. When I installed a local copy on my Windows 8.1 Pro machine, it works fine.
I know the admin pages all render in MVC-style, since the URL is "/admin/#/settings", for Settings for example.
I have literally tried everything. I verified that the application pool identity has Write permissions to the entire web site folder structure.
Any thoughts/ideas? I am completely stuck and would appreciate any guidance. Thanks in advance.
* UPDATE *
Some progress- I tried creating a standalone website in IIS just for BlogEngine.NET, i.e., http://www.example.com instead of http://www.example.com/blog, and it worked flawlessly.
Therefore, something is going screwy with the permissions when I am creating an Application within the main Website (i.e., www.example.com/blog).
Thoughts?
Ancient post, but adding these <appSettings> helped for me:
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="true" />
</appSettings>
Alternatively, you can start the section by getting rid of all inherited values:
<appSettings>
<clear />
<!-- Other settings here -->
</appSettings>
In my main site I explicitly had a setting <add key="webpages:Enabled" value="false" />, so that explains why it was necessary to add this.
You also need to do this for other sections, like <connectionStrings>.