Ok here is the truth it does not work. So here is what i did,
created a new asp.net mvc controller named it
FederationMetadata
Copied the code to generate the federation metadata in the Index action method
Always point to
https://<pc:name>/stsvirtualdirectoryname/FederationMetadata/
to get the federation metadata xml document
Code
if (STS.Configuration.Endpoints.WSFedMex)
{
EnsureInitialized();
var serializer = new MetadataSerializer();
var sb = new StringBuilder(512);
serializer.WriteMetadata(XmlWriter.Create(new StringWriter(sb),new XmlWriterSettings { OmitXmlDeclaration = true }), _entity);
return new ContentResult(){Content = sb.ToString(),ContentEncoding = Encoding.UTF8,ContentType = "text/xml"};
}
else
{
throw new HttpException(404, "Not found");
}