I'm setting up a Django application on IIS with boto3. I got the application running however I'm unable to query any data from AWS due to no profile configuration being detected.
I tried running the application as a service account with AWS permissions. Giving the account R/W permissions to folder.
Adding AWSProfileName and AWSProfilesLocation to web.config file
I have double checked all common issues regarding this error, however, I think that my configuration might be wrong (perhaps in the web.config file)
Web.Config file:
<add key="AWSProfileName" value="Name_of_profile"/>
<add key="AWSProfilesLocation" value="Path_to_credentials_folder"/>
The error I'm getting: The config profile (Profile_Name) could not be found
So I have figured this out.
In my code I was using session to connect to AWS
Session(Name_of_role).
The parameter should be empty:
Session()
In the web.config file:
<add key="AWSProfileName" value="aws-dev"/>
<add key="AWS_ACCESS_KEY_ID" value=""/>
<add key="aws_secret_access_key" value=""/>
<add key="aws_session_token" value=""/>
<add key="AWS_DEFAULT_REGION" value="us-east-1" />
What happened?
Python is using environmental variables through wfastcgi which means that it takes environmental variables from the web.config file under <appSettings> tag. The necessary configuration that I had to use was under boto3 documentation.
Related
On 64-bit Windows 10 and IIS 10, I am trying to develop and test a native HTTP module that will act as a WebSockets handler mapping for a specific set of script files. This is all in native C++ starting with RegisterModule(). I am not using any part of ASP.NET.
When I access a URL that should invoke the handler, I receive this response:
HTTP Error 500.21 - Internal Server Error
Handler "QuadooWebSocket" has a bad module "WebSocketModule" in its module list
Detailed Error Information:
Module IIS Web Core
Notification ExecuteRequestHandler
Handler QuadooWebSocket
Error Code 0x8007000d
More Information:
IIS core does not recognize the module.
I used the IIS Manager to setup the handler mapping, and it created an entry in the applicationHost.config file.
<handlers accessPolicy="Read, Script">
<other_modules />
<add name="QuadooWebSocket" path="*.qws" verb="*" modules="WebSocketModule" scriptProcessor="E:\dev\projects\trunk\target\debug\ActiveQuadoo.dll" resourceType="File" preCondition="bitness32" />
</handlers>
Before that, I installed support for WebSockets using the "Windows Features" control panel, and it also added a line to the applicationHost.config file.
<globalModules>
<other_modules />
<add name="WebSocketModule" image="%windir%\System32\inetsrv\iiswsock.dll" />
</globalModules>
When I attach Visual Studio to w3wp.exe, none of the breakpoints in my code are resolved. RegisterModule() is not being called. DllMain() isn't even being called. My module also implements IActiveScript, and IIS does load my module for classic ASP requests.
My code is being built into a 32-bit module, and I have enable32BitAppOnWin64="true" in the applicationHost.config file. This works for the Classic ActiveScript/ASP environment, but does this setting also work when using code that is expected to be loaded via the RegisterModule() export? If that's not the issue, then are there other steps needed to enable a native HTTP module for WebSockets?
Thanks!
After nearly two years, I decided to spend the past few days working on this again, and it's finally working!
To answer the 32-bit question... Yes, IIS can run a 32-bit WebSockets handler on a 64-bit OS.
As to why it's working now... I did rerun APPCMD.EXE again, and I poked around in the configuration until it looked like this:
<globalModules>
...
<add name="WebSocketModule" image="%windir%\System32\inetsrv\iiswsock.dll" />
<add name="WebSocketModule32" image="%windir%\SysWOW64\inetsrv\iiswsock.dll" />
<add name="QuadooWebSocket" image="E:\dev\projects\trunk\target\debug\ActiveQuadoo.dll" />
</globalModules>
<handlers accessPolicy="Read, Script">
...
<add name="QuadooWebSocket" path="*.qws" verb="*" modules="WebSocketModule32" scriptProcessor="E:\dev\projects\trunk\target\debug\ActiveQuadoo.dll" resourceType="File" preCondition="bitness32" />
...
</handlers>
<location path="Default Web Site">
<system.webServer>
<handlers>
<remove name="QuadooWebSocket" />
<add name="QuadooWebSocket" path="*.qws" verb="*" modules="QuadooWebSocket" scriptProcessor="E:\dev\projects\trunk\target\debug\ActiveQuadoo.dll" resourceType="File" requireAccess="Script" preCondition="bitness32" />
</handlers>
</system.webServer>
</location>
One difference is that my handler is now registered with the WebSocketModule32 module.
I could end the answer there, but after my handler was finally loaded, there were a number of issues that I had to work out before it actually worked correctly. Some of what I've learned might be useful to others.
Since I'm handling WebSockets asynchronously, I needed to return RQ_NOTIFICATION_PENDING from OnExecuteRequestHandler(). Otherwise, IIS immediately closed the connection.
When switching to WebSockets, this was the order I ended up using:
Set the module context.
Set the response status to 101.
Load my script VM.
Write headers (e.g. Sec-WebSocket-Protocol).
Flush() asynchronously.
If Flush() does not complete immediately, then it will be completed with a call to OnAsyncCompletion(). If it does complete immediately, use the same code path that would be called from OnAsyncCompletion() and do the following:
Get the named context for IIS_WEBSOCKET.
Cast the context to an IWebSocketContext pointer.
Start the asynchronous reader loop.
Return RQ_NOTIFICATION_PENDING.
After receiving the closing event from ReadFragment(), I call IndicateCompletion(RQ_NOTIFICATION_FINISH_REQUEST) to notify IIS that I am done with the connection. Before I added that, IIS wasn't calling my handler's CleanupStoredContext() method.
I have created new project web.net core without doing any changes and use the created default files. I can successfully run this using the debug mode, but if I am going to publish it on IIS it will give me error: HTTP Error 500.19 - Internal Server Error and here is the error details:
The requested page cannot be accessed because the related configuration data for the page is invalid.
Error code:
0x8007000d
I already tried to modify the web.config to point the processPath to my dotnet location but it still have the same error result:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\WebApplication1.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: d4e1dda9-f8ba-4752-883d-43c86faa3c60-->
I am not yet sure if this one is related to my IIS setup configuration. Any suggestion/comments if encountered this. TIA
check that under which application pool identity your site is running.
to check you could follow the below steps:
1)open iis manager.
2)select application pools and select your application pool name from the middle pane.
3)select the advance setting from the action pane.
then assign permission to the site folder.
1)open iis manager, select your site.
2)right-click on-site and select Edit permission.
3)In properties, windows select the security tab-> edit.
4)one pop up window will open in that select add.
5)in select user or group windows type "iusr" in object name text box and click ok and assign full permission.
6)Repeat the above steps and add "iis_iusrs" and "IIS AppPool\" user permission.
7)After doing changes restart the iis server.
You need to install the “ASP.NET Core/.NET Core: Runtime & Hosting Bundle” on to the server.
you could also set load user profile to true in iis application pool advance setting.
please refer this below link for more detail:
ASP.Net Core Publish: HTTP Error 500.19 - Internal Server Error
500.19 error or 502.5 error when hosting asp.net core 2 application inside IIS
We just moved one of our apps which is a .net windows service to a new 2016 server in a different domain than the Microsoft GP database server is in.
We are using EConnect 14 (GP 2015).
We are getting 1000's of these warning in the application event log, which causes a problem because we use System Center and when it sees all those warnings it is spiking the CPU to process them. They don't stop until we restart our windows service.
Here is the warning.
Distributed Transaction was used
This could be caused by new connection strings used within each xml document, but reusing the base transaction scope.
Configuration Setting 'ReuseBaseTransaction' is by default FALSE. Remove this configuration setting, or set it to FALSE if this was not the expected behavior.
i've tried adding this into the econnect service config and my apps config, tried setting it to false, tried true as well and the warning persists.
<appSettings>
<add key="ReuseBaseTransaction" value="false"/>
</appSettings>
We are using the econnect windows service, we are not bypassing the proxy and going directly to the stored procs.
Do you have any idea how to prevent this warning. I really don't care if the transaction is distributed or not. I found this related article but it offers no solution.
https://dynamicsgpland.blogspot.com/2010/09/econnect-2010-fills-event-log-with.html
as well as this one.
https://community.dynamics.com/gp/b/gpdynland/archive/2010/09/23/econnect-2010-fills-event-log-with-warning-34-distributed-transaction-was-used-34
-Randy
There is a flag in the eConnect API that you can configure in your app.config in order to disable the logging of these promotions.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="LogDtcPromotions" value="false"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
I have an ASP.NET Core 2.0 API that I am trying to debug using VS2017 / IIS Express on my local Win10 dev computer and I am running into an issue with IIS Express in that it is hitting the response timeout default of 2 minutes before my process can complete in my API, thus returning a 502.3 - Bad Gateway message.
I process continues to run in my API and completes after 3 minutes and 50 seconds. So, I need to increase the request timeout for IIS Express.
Most of the examples I have found on the web talk about using the web.config, for example;
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore requestTimeout="00:20:00" processPath="dotnet" arguments=".\MyAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
... but from what I understand, An ASP.NET Core 2.0 API running on the local IIS Express doesn't uses a web.config from my project bt rather, it relies on launchSettings.json in the project. However, I have not been able to find anything on the web that talks about launchSettings having any settings values for increasing default timeouts.
Just to confirm, I tried putting a web.config file, like what I listed above, in my project's wwwroot folder, but it made no difference. This worked on my deployed solution in Azure (see related Stack Overflow post) but doesn't in IIS Express on my local dev.
This seems like it should be a simple task but so far I have not had any luck finding a solution.
Any ideas?
EDIT 5/27/18 - SOLUTION
IIS Express with ASP.NET Core 2.0 uses a file similar to a web.config called applicationhost.config, which is located in the project root/.vs/config folder. This file has a
<configuration><Location> ... <location</configuration>
section similar to what I have listed below. This section has the
<aspNetCore ... />
node where I was able to apply the requestTimeout value. By setting that, my dev system was able to get past the default 2 minute timeout.
<location path="MyAPI">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<httpCompression>
<dynamicCompression>
<add mimeType="text/event-stream" enabled="false" />
</dynamicCompression>
</httpCompression>
<aspNetCore requestTimeout="00:20:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="false" />
</system.webServer>
</location>
You misunderstood the concepts.
launchSettings.json is only used by Visual Studio to determine how to run your web project. (More info in my blog post)
IIS Express still relies on web.config to read the settings, as that's the only file it understands.
My WCF serice seems to be using the computer-name instead of the domain name. When I view the MyService.svc?wsdl link it is showing my computer name.
Where do I add my domain name in the web.config? Endpoint address, baseaddress or identity?
Note: I am using SSL so it has to be https://www.example.com/myservice.svc
WCF 4.0 has solved this issue in some instances with a new config option that use Request Headers:
<behaviors>
<serviceBehaviors>
<behavior name="AutoVaultUploadBehavior">
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="https" port="443" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
For IIS7 you don't add it to web.config, but to the IIS configuration file.
First off edit the bindings for your web site so the HTTP protocol specifies a host name if you haven't already - this will ensure it gets the correct name under HTTP.
Navigate to C:\Windows\System32\inetsrv\config and open applicationHost.config
Look for the sites section. You will see something like the following
<sites>
<site name="Default Web Site" id="1">
<application path="/">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:puck" />
<binding protocol="net.tcp" bindingInformation="808:*" />
<binding protocol="net.pipe" bindingInformation="*" />
<binding protocol="net.msmq" bindingInformation="localhost" />
<binding protocol="msmq.formatname" bindingInformation="localhost" />
<binding protocol="http" bindingInformation="*:80:puck.idunno.org" />
<binding protocol="http" bindingInformation="*:80:localhost" />
<binding protocol="https" bindingInformation="*:443:" />
</bindings>
</site>
....
</sites>
You can see that the bindings for the http protocol specify a host header, but https doesn't. When you're web browsing you can't use host headers over HTTPS, but WCF still uses it when generating the WSDL - if it can't find one it will fall back to the machine name.
So all you need to do is edit the HTTPS binding like so
<binding protocol="https" bindingInformation="*:443:puck" />
appending the correct FQDN to the end of the binding information. Reset IIS and WCF should get it right now.
The IIS6 solution has already been posted by darin
As stated in this link WCF is using the computer name instead of the IP address and cannot be resolved
It solved my problem, maybe because i have multiple web sites in the same host, and is very simple.
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
To fix this problem Configure the httpGetEnabled attribute and httpsGetEnabled attribute in web.config file
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
We're using WCFExtras to change the name of the host.
WCFExtras is a small open source library that will allow you to write the following to change the host name:
<behaviors>
<endpointBehaviors>
<behavior name="xxx">
<wsdlExtensions location="http://some-hostname-visible-from-outside/path-to-a-service/service.svc" singleFile="True" />
</behavior>
...
just adding
<useRequestHeadersForMetadataAddress></useRequestHeadersForMetadataAddress> to the solved my issue.
It seems that WCF 4.0 takes care of the Headers by adding this
I was using SSL for accessing the WCF Service.
I have added solutions here, http://knowledgebaseworld.blogspot.com/2010/06/domain-name-replaced-with-machine-name.html. it should work for you all as its working fine with me on local, staging and production without doing binding on iis
None of these solutions were helpful to me. I was able to solve this with a very simple custom Service Factory.
Installing a WCF Service on a Shared Hosting Site, Revisited
Have you tried setting the host header in IIS?
Although its an old posting, here is an answer.
Under Service Behaviour --> ServiceMetaData add service url.
Please note if you do not add myService, it will throw another error.
I had this very issue with my production server. I have found various articles on the multiple host headers with IIS and WCF issue, but if you are using SSL, you cannot add a host header to the website identities within the IIS UI, you can only add them to normal HTTP identities:
However you can add SSL host headers via a command prompt script, and this solved the issue for me:
cscript.exe adsutil.vbs set /w3svc/<site identifier>/SecureBindings ":443:<host header>"
For more information on this see this link: http://blumenthalit.net/blog/Lists/Posts/Post.aspx?ID=14
This post solved it for me. I needed to associate my domain name with my IP address and website in IIS.
http://www.codemeit.com/wcf/wcf-wsdl-xsdimport-schemalocations-link-to-local-machine-name-not-domain-name-while-hosted-in-iis.html
Thanks to Kanasz Robert.
Steps that solved my problem -
1.Produce the wsdl in the browser and save to file (by hitting .svc?wsdl from browser) save as .wsdl
Produce the xsd files by hitting url from wsdl (xsd=xsd0, etc), and save to file from browser, save as .wsdl
replace all machine name references from wsdl with domain name (or ip address) and change xsd references and save AND replace all machine name references from xsd files with domain name (or ip address)
make sure to name xsd file with .xsd extension (ie, name0.xsd, name1.xsd, name2.xsd)
copy wsdl and xsd file(s) to virtual directory
add to your web.config following lines:
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" externalMetadataLocation="http://IPorDomainName/MyServices/FileTransferService.wsdl" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>