I am trying to host a Flask Web app on a Windows Server 2012.
I have followed the instructions in http://developer.e-power.com.kh/publish-flask-on-iis/
At first it did not work but after enabling the HTTP Activation Windows Feature I was able to get the following error message after browsing http://localhost:80/ :
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 711, in main env, handler = read_wsgi_handler(response.physical_path)
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 568, in read_wsgi_handler return env, get_wsgi_handler(handler_name)
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 551, in get_wsgi_handler raise ValueError('"%s" could not be imported' % handler_name)
ValueError: "app.app" could not be imported
StdOut:
StdErr:
The web.config file, which was automatically generated after following the instructions in the link above, is:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="FlaskHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python27\python.exe|c:\inetpub\wwwroot\convnet\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
Make sure you have app object is importable from app.py. Looks like it doesn't find it:
ValueError: "app.app" could not be imported
Related
I am using a WildFly(version - 19) to do file directory listing using below configuration.
<subsystem xmlns="urn:jboss:domain:undertow:10.0">
...
<host name="default-host" alias="localhost">
<location name="/SoftwareRepository" handler="SoftwareRepo"/>
</host>
...
<handlers>
<file name="SoftwareRepo" path = "<Path to Directory>" case-sensitive="false" directory-listing="true"/>
</handlers>
</subsystem>
This works fine for me and listing the file list for the respective configured path. B
Now, my worry is about authentication. The file directory listing is happening when I access the URL but without any authentication.
How to add any authentication mechanism to do this file handler?
I'm getting a bad gateway due to a timeout of 2 minutes but I don't now how to configure it, the following is what I have tried.
So, first of all, in python I'm setting a 120 second timeout (I don't want to change this, I've tried with 115 seconds and it works but I want to resolve the external timeout from IIS or waitress, I don't want to change this limit in my internal software).
try:
# ...
req = http.request("POST", url = url, timeout=120, body = body, headers=headers)
# ...
except urllib3.exceptions.RequestError as exc:
log.error("reporting exc type %s message %s", type(exc), exc)
return render_template_string("External API is not responding")
I've set this in Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpRuntime executionTimeout="200" />
</system.web>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform
etc...
and in my waitress batch:
F:
cd F:\Appl\flask
venv\scripts\waitress-serve.exe --channel-timeout=300 --host=127.0.0.1 --port=%1 sample00:app
And from IIS Configure > Limits
I've set "Connection time-out (in seconds):" 200
Finally solved by adding requestTimeout="00:05:00" in the httpPlatform tag of the web.config
I have this code in server.go :
package main
import (
"fmt"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "You just browsed page (if blank you're at the root): %s", r.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":"+os.Getenv("HTTP_PLATFORM_PORT"), nil)
}
and this web.config :
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="d:\home\site\wwwroot\go\bin\go.exe"
arguments="run d:\home\site\wwwroot\server.go"
startupTimeLimit="60">
<environmentVariables>
<environmentVariable name="GOROOT" value="d:\home\site\wwwroot\go" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Both of these files are in the d:\home\site\wwwroot directory of an Azure App Service. I also have the 1.13.3 version of the x64 Windows go runtime installed (unzipped from go1.13.3.windows-amd64.zip) in d:\home\site\wwwroot\go.
When I browse to fwWebApi.azurewebsites.net/hello it times out.
I got this sample from http://www.wadewegner.com/2014/12/4-simple-steps-to-run-go-language-in-azure-websites/ which is admittedly a few years old. But I want to be able to run a Go web application in Azure App Services.
Can anyone suggest what I can do?
I strongly suggest you use a docker image to run your non supported language on azure app services:
Supported languages ASP.NET, ASP.NET Core, Java, Ruby, Node.js, PHP, or Python
Github: https://github.com/AnassKartit/helloworld-golang
Docker Image
https://hub.docker.com/r/anasskartit/hello-world-golang
First Run will take some time as it downloads the image you can check the logs
Result
I'm getting the following error when navigating to my IIS published .netcore application:
I have set up my web.config file as so:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\KritnerWebsite.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
Not sure if this warning is relevant or just outdated:
Severity Code Description Project File Line Source Suppression State
Warning The element 'system.webServer' has invalid child element 'aspNetCore'. List of possible elements expected: 'asp, caching, cgi, defaultDocument, directoryBrowse, globalModules, handlers, httpCompression, webSocket, httpErrors, httpLogging, httpProtocol, httpRedirect, httpTracing, isapiFilters, modules, applicationInitialization, odbcLogging, security, serverRuntime, serverSideInclude, staticContent, tracing, urlCompression, validation, management, rewrite'. KritnerWebsite D:\gitWorkspace\KritnerWebsite\src\KritnerWebsite\web.config 12 Build
The line in the web.config was as per the template, I just changed "false" to "true" for stdoutLogEnabled.
I have also created an empty folder in the root directory "logs" - I wasn't sure if this should get created automatically or not. Either way, nothing is being written to the logs, so I am not sure what to try next.
I have opened the solution in VS2015 on my host, compiled it and ran it successfully through commandline/localhost with dotnet run. This is running it in the production configuration, so pulling from my environment variables for insights key, and connection string. So I'm not sure why the site would run successfully on my host through dotnet run but not when published to IIS
How do I get further information on what the error is?
I'm not sure what exactly caused the logs to start correctly recording in ./logs... but they did. With the exception now being recorded I could see that my connection string I had set up in my Environment Variables was off.
Still not sure what caused the logs to not write out in order for me to determine this faster.
After updating my environment variable and running iisreset as per https://serverfault.com/questions/193609/make-iis-see-updated-environment-path-variable my website is now being served properly.
I am new to Dynamics CRM. iam try to generate the data context class using CrmSvcUtil.exe
this is my command
CrmSvcUtil.exe /out:E:\OrgXrm.cs
/url:https://mdtestuser.api.crm5.dynamics.com/XRMServices/2011/Organization.svc
/username:MDTest#MDTestUser.onmicrosoft.com /password:Password
/deviceid:11bdver2vrqok88p7ek8r5umk0 /devicepassword:.devicepassword
but its giving an error ;
Exiting program with exception: An error occurred when verifying security for th
e message.
Enable tracing and view the trace files for more information.
CrmSvcUtil.exe Error: 0 : Exiting program with exit code 2 due to exception : Sy
stem.ServiceModel.FaultException: An error occurred when verifying security for
the message.
Did you try specifying the port in the end of the URL?
Also Verify the Time and Date settings (including timezones) are set correctly on both the server and your client machine. It seems that if the two machines are out of sync by more than a minute or two it will cause this problem.
Refer the below link:
http://msdn.microsoft.com/en-in/library/gg327844.aspx
To fully understand your error, you should use config file with enable tracing, here is an example of config file:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="servicecontextname" value="XrmServiceContext"/>
<add key="codecustomization" value="Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"/>
<add key="username" value="domain\user"/>
<add key="password" value="password"/>
<add key="out" value="XrmEntitiesReference.cs" />
</appSettings>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener">
<filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" />
</add>
</listeners>
</trace>
</system.diagnostics>
</configuration>
check out example from here:
http://www.resultondemand.nl/support/sdk/06abab26-40fc-4b85-9a2a-5e68903ea138.htm
Try it without:
/deviceid /devicepassword
Hi if you are having trouble executing your command try doing it through Visual Studio, the link below shows an excellent step-by-step guide how to use CrmSvcUtil:
http://mscrmshop.blogspot.co.uk/2012/03/how-to-use-crmsvcutil-improved-version.html