s3fs: How to mount S3 buckets on AWS EC2 instances behind proxy, using IMDS v2 - amazon-s3

We are having some trouble to mount an AWS S3 bucket (using s3fs v1.90) into an AWS EC2 instance which:
is running Ubuntu 18.04
requires IMDS v2 session tokens
is behind a proxy
The HTTP response code returned by the curl lib is "417 - Expectation Failed" (more details below). I found some hints on the www that the 417 error might relate to our proxy config, see:
HTTP POST Returns Error: 417 "Expectation Failed."
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LuWSAU
This makes me believe that our NO_PROXY config is not being picked up by s3fs, but I'm really not sure...
Anyway, this is what we've tried to do in order to mount the bucket:
sudo s3fs SOME_BUCKET ./mnt-s3/ -o iam_role=SOME_ROLE,url=https://s3.eu-central-1.amazonaws.com,endpoint=eu-central-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp/s3foldercache,dbglevel=debug -f
This is the output:
2021-09-08T12:36:27.681Z [INF] curl.cpp:CheckIAMCredentialUpdate(1826): IAM Access Token refreshing...
2021-09-08T12:36:27.681Z [INF] curl.cpp:GetIAMCredentials(3068): [IAM role=SOME_ROLE]
2021-09-08T12:36:27.681Z [DBG] curl_handlerpool.cpp:GetHandler(81): Get handler from pool: rest = 31
2021-09-08T12:36:27.681Z [DBG] curl.cpp:RequestPerform(2509): connecting to URL http://169.254.169.254/latest/api/token
2021-09-08T12:36:27.682Z [ERR] curl.cpp:RequestPerform(2622): HTTP response code 417, returning EIO. Body Text: <?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>417 - Expectation Failed</title>
</head>
<body>
<h1>417 - Expectation Failed</h1>
</body>
</html>
2021-09-08T12:36:27.682Z [ERR] curl.cpp:GetIAMCredentials(3105): AWS IMDSv2 token retrieval failed: -5
2021-09-08T12:36:27.682Z [DBG] curl.cpp:RequestPerform(2509): connecting to URL http://169.254.169.254/latest/meta-data/iam/security-credentials/SOME_ROLE
2021-09-08T12:36:27.684Z [ERR] curl.cpp:RequestPerform(2622): HTTP response code 401, returning EIO. Body Text: <?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>401 - Unauthorized</title>
</head>
<body>
<h1>401 - Unauthorized</h1>
</body>
</html>
2021-09-08T12:36:27.684Z [ERR] curl.cpp:CheckIAMCredentialUpdate(1830): IAM Access Token refresh failed
2021-09-08T12:36:27.684Z [DBG] curl_handlerpool.cpp:ReturnHandler(103): Return handler to pool
2021-09-08T12:36:27.684Z [INF] curl_handlerpool.cpp:ReturnHandler(110): Pool full: destroy the oldest handler
2021-09-08T12:36:27.685Z [CRT] s3fs.cpp:s3fs_check_service(3520): Failed to check IAM role name(SOME_ROLE).
2021-09-08T12:36:27.685Z [ERR] s3fs.cpp:s3fs_exit_fuseloop(3372): Exiting FUSE event loop due to errors
When running curl directly, though, we do receive a valid IMDS v2 token:
$ curl -v -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" http://169.254.169.254/latest/api/token
* Trying 169.254.169.254...
* TCP_NODELAY set
* Connected to 169.254.169.254 (169.254.169.254) port 80 (#0)
> PUT /latest/api/token HTTP/1.1
> Host: 169.254.169.254
> User-Agent: curl/7.58.0
> Accept: */*
> X-aws-ec2-metadata-token-ttl-seconds: 21600
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Length: 56
< Content-Type: text/plain
< Date: Wed, 08 Sep 2021 13:14:02 GMT
< X-Aws-Ec2-Metadata-Token-Ttl-Seconds: 21600
< Connection: close
< Server: EC2ws
<
* Closing connection 0
SOME_TOKEN
Finally, this is our proxy config (defined by environment variables):
$ echo $HTTP_PROXY
<SOME_HOST>:<SOME_PORT>
$ echo $NO_PROXY
169.254.169.254,*.eu-central-1.amazonaws.com
So, my best guess is that s3fs might be ignoring the NO_PROXY variable, trying to use our proxy when asking local IP 169.254.169.254 for a new token.

A fix for this is being worked on in https://github.com/s3fs-fuse/s3fs-fuse/pull/1766

Related

Arduino esp8266 device gets Bad Request error from apache server while making request from

I am sending post request from my arduino device to my hosted server it gives me 400 Bad request error.
Same code runs well in my localhost but not working on Hosted server.
My arduino code if give below.
void callApi(String ID,String path,int comm,String message,int isResponseNeeded) {
String serverPath="www.xyz.com";
String data = "{" ;
data = data + "\"id\": \""+ID+"\"," ;
data = data + "\"version\": \""+VERSION+"\"," ;
data = data + "\"command\": \""+comm+"\"," ;
data = data + "\"message\": \""+message+"\"" ;
data = data + "}" ;
Serial.print("Send data...on=>");
Serial.println(path);
if (wifiClient.connect(serverPath,80)) {
Serial.println(data);
wifiClient.println("POST /abc/xyz HTTP/1.1");
wifiClient.println("Content-Type: application/json");
wifiClient.print("Host: ");
wifiClient.println(serverPath);
wifiClient.print("Content-Length: ");
wifiClient.println(data.length());
wifiClient.print("\n");
wifiClient.print(data);
wifiClient.print("\n");
Serial.println("Data sent...Reading response..");
if(isResponseNeeded>0){
unsigned long timeout = millis();
while (wifiClient.available() == 0) {
if (millis() - timeout > 10000) {
Serial.println(">>> Client Timeout !");
break;
}
}
String response;
while(wifiClient.available()){
String line = wifiClient.readStringUntil('\n');
response=line;
Serial.println(response);
}
Serial.println(response.length());
}
out put of this code.
{"id": "_60_1_94_f_a9_3c_","version": "1.10","command": "0","message": ""}
Data sent...Reading response..
HTTP/1.1 400 Bad Request
Date: Sat, 20 May 2017 05:13:41 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 324
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at ubuntu-512mb-nyc2-01.localdomain Port 80</address>
</body></html>
===========================================================
And one one more thing i have observed that. it runs GET request fine. only it cause issue while making POST request on my hosted server.
I guess that API service requires POST content and body to be application/x-www-form-urlencoded encoded.
application/x-www-form-urlencoded or multipart/form-data?

What can cause a handler to be ignored?

We moved to a new server and my Thinktecture IdentityModel stuff broke.
Here's a super simplified repro sample. This works run locally from Visual Studio, but deployed to the server the handler is clearly not handling.
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Thinktecture.IdentityModel.Tokens.Http;
namespace WebApplication1
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configuration.MessageHandlers.Add(
new AuthenticationHandler(CreateConfiguration()));
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
private AuthenticationConfiguration CreateConfiguration()
{
var config = new AuthenticationConfiguration
{
EnableSessionToken = true,
RequireSsl = false,
SendWwwAuthenticateResponseHeaders = false
};
config.AddBasicAuthentication(
(username, password) => { return username == password; });
return config;
}
}
}
The handler is not executing. I have set up remote debugging and this revealed that
The Thinktecture assembly is loaded
Application_Start creates and adds a basic auth handler
This script is the test client
<script>
$(document).ready(function () {
var u = "bilbo";
var p = "bilbo";
var btoken = btoa(u + ":" + p);
$.ajax({
url: "api/token",
headers: { Authorization: "Basic " + btoken },
}).then(function (result) {
document.write("auth ok");
}).fail(function (error) {
document.write("auth fail");
});
});
</script>
It produces a request for api/token decorated with a basic auth header as shown:
GET http://assa.com.au/api/token HTTP/1.1
Accept: */*
Authorization: Basic YmlsYm86YmlsYm8=
X-Requested-With: XMLHttpRequest
Referer: http://assa.com.au/sandpit
Accept-Language: en-AU,en-GB;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: assa.com.au
Connection: Keep-Alive
This server responds with this 401
HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Microsoft-IIS/8.5
WWW-Authenticate: Basic realm="assa.com.au"
X-Powered-By: ASP.NET
Date: Wed, 17 Feb 2016 01:36:27 GMT
Content-Length: 1293
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>401 - Unauthorized: Access is denied due to invalid credentials.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
<h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
</fieldset></div>
</div>
</body>
</html>
Visual Studio 2013 is showing valid breakpoints in the handler but they are not hit. This is why I believe the handler is not being invoked.
The response specifies a realm, but modifying handler registration to specify realm = "assa.com.au" did not affect the outcome.
The answer lies in the handling of the absence of trailing slashes.
The test page is requested as assa.com.au/sandpit which does return the right HTML.
Close inspection of the 401 response reveals that the request is for api/token which is not the correct URL for the token dispenser - it should be sandpit/api/token
Requesting the test page as assa.com.au/sandpit/ causes the requested URL to become sandpit/api/token and everything comes out in the wash.
But why is it 401? Shouldn't it be 404 not found? It turns out that the webserver was configured to respond to unauthorised requests by asking the user agent to authenticate, expressed as a 401 auth demand.
The incorrect URL left things in an unauthorised state, producing a 401 auth demand.

CANDY chat with Openfire : receiving empty response while connecting to a autologin chat room

I finally have the openfire server installed - admittedly noob to XMPP - but I'm getting there :)
I modified the .htaccess & now trying to hit the http://166.xx.xx.xx/candy-chat-candy-ca544b1/example/index.html on my server
The page shows me a "connecting.." message and hangs there.
Here is my setup before I delve into the firebug post/response.
I've modified the example/index.html as such :
$(document).ready(function() {
Candy.init('http://166.xx.xx.xx:7070/http-bind/', {
core: { debug: true },
autojoin: ['Opentalk#conference.166.xx.xx.xx'],
view: { language : 'en' }
});
Candy.Core.connect('166.xx.xx.xx', null, 'Guest'); // Connect anonymously to a specific server
});
In firebug, I see that the response is empty. However the post entry in firebug shows a 200 OK
And firebug complains (which I think is because the response is empty) --> "
XML Parsing Error: no element found Location:
moz-nullprincipal:{80250471-6b20-4144-ad88-92777a926018} Line Number
1, Column 1:
Here is the post
<body rid='3954428912' xmlns='http://jabber.org/protocol/httpbind' to='166.xx.xx.xx' xml:lang='en' wait='60' hold='1' content='text/xml;
charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
Since my debug is turned on, I see the same message as post :
SENT: <body rid='3954428912' xmlns='http://jabber.org/protocol/httpbind' to='166.xx.xx.xx' xml:lang='en' wait='60' hold='1' content='text/xml;
charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
Note : The only difference I see in my configuration is the the cross-domain part.
The setup screenshot shown on github has this field empty, while mine has the default entry, I don't know if that is in fact a problem though.
I'm doing something wrong, but can't put a finger as to what..
Any pointers about debugging further would be great !
----------------+++++++++++--------------
Update 2/1 **
Thanks Michael, seems making the changes has taken it a step forward !!
Now I'm getting a grey page instead of hanging at "connecting..".
Seems the connection is now being established. I'm not sure if the PrivacyListError is critical (correct me).
I looked into the candy.js & seems that if the list doesn't exist it'll create one.
The next error does seem critical, since it talks about service unavailable..
Success
SENT: <body rid='2569503371' xmlns='http://jabber.org/protocol/httpbind' sid='b967c785'><iq type='set' id='_session_auth_2' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq></body> RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_session_auth_2' to='b967c785#myservername.com/b967c785'/></body>
[Connection]
Connected [Jabber]
Anonymous login
[Connection] Attached
Success
POST http-bind/ 200 OK 101ms
SENT: <body rid='2569503372' xmlns='http://jabber.org/protocol/httpbind' sid='b967c785'><presence xmlns='jabber:client'/><iq type='get' xmlns='jabber:client'><query xmlns='jabber:iq:private'><storage xmlns='storage:bookmarks'/></query></iq><iq type='get' from='b967c785#myservername.com/b967c785' id='get1' xmlns='jabber:client'><query xmlns='jabber:iq:privacy'><list name='ignore'/></query></iq></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' to='b967c785#myservername.com/b967c785'><query xmlns='jabber:iq:private'><storage xmlns='storage:bookmarks'/></query></iq></body>
[Jabber] Bookmarks
Error
POST http-bind/ 200 OK 56ms
SENT: <body rid='2569503373' xmlns='http://jabber.org/protocol/httpbind' sid='b967c785'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='error' id='get1' to='b967c785#myservername.com/b967c785'><query xmlns='jabber:iq:privacy'><list name='ignore'/></query><error code='503' type='cancel'> <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq></body>
[Jabber] PrivacyListError
Error - this seems more serious
POST http-bind/ 200 OK 74ms
SENT: <body rid='2569503374' xmlns='http://jabber.org/protocol/httpbind'
sid='b967c785'><iq type='set' from='b967c785#myservername.com/b967c785' id='set1'
xmlns='jabber:client'><query xmlns='jabber:iq:privacy'><list name='ignore'><item
action='allow' order='0'/></list></query></iq><iq type='set'
from='b967c785#myservername.com/b967c785' id='set2' xmlns='jabber:client'><query
xmlns='jabber:iq:privacy'><active name='ignore'/></query></iq></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client'
type='error' id='set1' to='b967c785#myservername.com/b967c785'><query
xmlns='jabber:iq:privacy'><list name='ignore'><item action='allow' order='0'/></list>
</query><error code='503' type='cancel'><service-unavailable
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq></body>
Error - Last one, before it kinda hangs in the there
POST http-bind/ 200 OK 60ms
SENT: <body rid='2569503375' xmlns='http://jabber.org/protocol/httpbind' sid='b967c785'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client'
type='error' id='set2' to='b967c785#myservername.com/b967c785'><query
xmlns='jabber:iq:privacy'><active name='ignore'/></query><error code='503' type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq></body>
Last ajax call fired
POST http-bind/ 200 OK 60167ms
SENT: <body rid='2569503376' xmlns='http://jabber.org/protocol/httpbind' sid='b967c785'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'/>
POST http-bind/
SENT: <body rid='2569503377' xmlns='http://jabber.org/protocol/httpbind' sid='b967c785'/>
Your http-bind url seems to be wrong as well as the autojoin and the first param of the connect function call.
If you configured the HTTP Proxy configuration correctly, the standard example/index.html should work.
You only need to change/add the autojoin param and change the connect function call.
Regarding the autojoin parameter: You configured a virtualhost on the XMPP server. You need to use this one as the hostname, not the IP. So it would look like autojoin: ['Opentalk#conference.example.com'].
The same applies to the first parameter of connect() you need to provide the virtual hostname of the XMPP Server.

Error (JSON 404): <!DOCTYPE HTML PUBLIC "-//IETF/

When I run "vmc info", I get an error : Error (JSON 404):
cloud#rest:~/cloudfoundry/.deployments/rest/log$ vmc info -t
>>>
REQUEST: get http://api.mwt.needforspeed.info/info
RESPONSE_HEADERS:
content_length : 239
date : Thu, 11 Oct 2012 07:32:17 GMT
content_type : text/html; charset=iso-8859-1
content_encoding : gzip
server : Apache/2.2.22 (Ubuntu)
vary : Accept-Encoding
RESPONSE: [404]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /info was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at api.mwt.needforspeed.info Port 80</address>
</body></html>
<<<
Error (JSON 404): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /info was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at api.mwt.needforspeed.info Port 80</address>
</body></html>
It looks like you have apache webserver running on port 80.
If you install cloudfoundry to a plain vanilla Ubuntu, it will install nginx as a webserver.
So first stop your apache, normally with:
sudo /etc/init.d/apache2 stop
and than check that your nginx (router in cloudfoundry's term) is running:
source ~/.cloudfoundry_deployment_local
~/cloudfoundry/vcap/dev_setup/bin/vcap_dev -n rest status router
please note that you need the extra -n rest parameter as it seems that you didn't use the default development name: dev_box

wcf service doesn't allow POST

I'm quite new to webervices in general and am getting stuck in (I think) configuring IIS and the webservice itself.
I created a wcf webservice in MVS 2010 and hosted it on IIS7.5 on windows 7.
I use soapUI 4.5.0 to post a message generated from the same wsdl description I created the webservice contract with. Issue is that I get 405 due to the fact that http POST not seems to be supported by the webservice or webserver.
Even though I had the idea the error I get would be sufficient to solve my problem, my lack of knowledge about IIS and webservices makes I can't find the right solution.
Below as much information as I could think of. Hope it is of any help and someone can guide me in the right direction.
Configurations made in IIS:
Authorization rule: allow, all users
Directory browsing: enabled
Handler mappings: features permissions: read, script and execute
Handler mappings: added *.wsdl -> ProtocolSupportModule -> GET, HEAD, OPTIONS, TRACE, POST
Application pools: added entry with identity NetworkService using
.net fw 4.0
This is the message sent:
RAW:
POST http: x.x.x.x:21378/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8;action="/BootNotification"
XML:
<soap:Envelope xmlns:soap="org/2003/05/soap-envelope" xmlns:ns="urn://Ocpp/Cs/2012/02/">
<soap:Header/>
<soap:Body>
<ns:bootNotificationResponse>
<ns:status>Accepted</ns:status>
<ns:currentTime>${now}</ns:currentTime>
<ns:heartbeatInterval>900</ns:heartbeatInterval>
</ns:bootNotificationResponse>
</soap:Body>
</soap:Envelope>
This is the result returned:
I truncated it to limit the size of this post.
RAW:
HTTP/1.1 405 Method Not Allowed
Cache-Control: private
Allow: GET, HEAD, OPTIONS, TRACE
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Thu, 07 Jun 2012 07:58:09 GMT
Content-Length: 5611
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns=".org/1999/xhtml">
<head>
<title>IIS 7.5 Detailed Error - 405.0 - Method Not Allowed</title>
<style type="text/css">
...
...
...
<div class="content-container">
<fieldset><legend>Most likely causes:</legend>
<ul> <li>The request sent to the Web server used an HTTP verb that is not allowed by the module configured to handle the request.</li> <li>A request was sent to the server that contained an invalid HTTP verb.</li> <li>The request is for static content and contains an HTTP verb other than GET or HEAD.</li> <li>A request was sent to a virtual directory using the HTTP verb POST and the default document is a static file that does not support HTTP verbs other than GET or HEAD.</li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><legend>Things you can try:</legend>
<ul> <li>Verify the list of verbs enabled for the module handler this request was sent to, and ensure that this verb should be allowed for the Web site.</li> <li>Check the IIS log file to see which verb is not allowed for the request.</li> <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here. </li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><legend>Links and More Information</legend>
This error means that the request sent to the Web server contained an HTTP verb that is not allowed by the configured module handler for the request.
<p>View more information »</p>
</fieldset>
</div>
</div>
</body>
</html>
XML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ".org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns=".org/1999/xhtml">
<head>
<title>IIS 7.5 Detailed Error - 405.0 - Method Not Allowed</title>
<style type="text/css">
...
</head>
<body>
<div id="header"><h1>Server Error in Application "SHENZIWEBSERVICEDEPLOYED"</h1></div>
<div id="server_version"><p>Internet Information Services 7.5</p></div>
<div id="content">
<div class="content-container">
<fieldset><legend>Error Summary</legend>
<h2>HTTP Error 405.0 - Method Not Allowed</h2>
<h3>The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.</h3>
</fieldset>
</div>
<div class="content-container">
...
</div>
<div class="content-container">
<fieldset><legend>Most likely causes:</legend>
<ul> <li>The request sent to the Web server used an HTTP verb that is not allowed by the module configured to handle the request.</li> <li>A request was sent to the server that contained an invalid HTTP verb.</li> <li>The request is for static content and contains an HTTP verb other than GET or HEAD.</li> <li>A request was sent to a virtual directory using the HTTP verb POST and the default document is a static file that does not support HTTP verbs other than GET or HEAD.</li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><legend>Things you can try:</legend>
<ul> <li>Verify the list of verbs enabled for the module handler this request was sent to, and ensure that this verb should be allowed for the Web site.</li> <li>Check the IIS log file to see which verb is not allowed for the request.</li> <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here. </li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><legend>Links and More Information</legend>
This error means that the request sent to the Web server contained an HTTP verb that is not allowed by the configured module handler for the request.
<p>View more information »</p>
</fieldset>
</div>
</div>
</body>
</html>
This is part of the generated servicecontract (wsdl /language:CS /serverInterface
// CODEGEN: The optional WSDL extension element 'PolicyReference' from namespace 'http://schemas.xmlsoap.org/ws/2004/09/policy' was not handled.
[ServiceContract(Name = "CentralSystemServiceSoap", Namespace = "urn://Ocpp/Cs/2010/08/")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Web.Services.WebServiceBindingAttribute(Name="CentralSystemServiceSoap", Namespace="urn://Ocpp/Cs/2010/08/")]
public interface ICentralSystemServiceSoap {
/// <remarks/>
[OperationContract]
[System.Web.Services.Protocols.SoapHeaderAttribute("chargeBoxIdentity")]
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("/BootNotification", RequestElementName = "bootNotificationRequest", RequestNamespace = "urn://Ocpp/Cs/2010/08/", ResponseElementName = "bootNotificationResponse", ResponseNamespace = "urn://Ocpp/Cs/2010/08/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("status")]
RegistrationStatus BootNotification(string chargePointVendor, string chargePointModel, string chargePointSerialNumber, string chargeBoxSerialNumber, string firmwareVersion, string iccid, string imsi, string meterType, string meterSerialNumber, out System.DateTime currentTime, [System.Xml.Serialization.XmlIgnoreAttribute()] out bool currentTimeSpecified, out int heartbeatInterval, [System.Xml.Serialization.XmlIgnoreAttribute()] out bool heartbeatIntervalSpecified);
I didn't understand how your service is built and what you have done there, but from my experience, this is a simple way to create a wcf RESTful service that supports POST requests:
http://www.codeproject.com/Articles/201901/CREATE-RESTful-WCF-Service-API-Using-POST-Step-By
Update according to the comments:
try using that:
[OperationContract]
[WebInvoke(Method = "POST")]
[System.Web.Services.Protocols.SoapHeaderAttribute("chargeBoxIdentity")]
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("/BootNotification", RequestElementName = "bootNotificationRequest", RequestNamespace = "urn://Ocpp/Cs/2010/08/", ResponseElementName = "bootNotificationResponse", ResponseNamespace = "urn://Ocpp/Cs/2010/08/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("status")]
RegistrationStatus BootNotification(string chargePointVendor, string chargePointModel, string chargePointSerialNumber, string chargeBoxSerialNumber, string firmwareVersion, string iccid, string imsi, string meterType, string meterSerialNumber, out System.DateTime currentTime, [System.Xml.Serialization.XmlIgnoreAttribute()] out bool currentTimeSpecified, out int heartbeatInterval, [System.Xml.Serialization.XmlIgnoreAttribute()] out bool heartbeatIntervalSpecified);
UPDATE
try doing that:
On IIS 7.5 -> YourWebsite -> Handler Mappings
Choose "Add module mapping" option on the right side of the panel
In "Request path" field enter *.wsdl
In "Module" field enter "ProtocolSupportModule"
Click on "Request restrictions" and go to Verbs tab
Enter POST verb
Save changes