dotnetopenauth samples "Attempt by method 'DotNetOpenAuth.OAuth2.WebServerClient ..." - oauth-2.0

I've just been spending hours on an issue that some others have reported to experience too.
The Sample.Oauth2.OAuthClient projet sample does not work for me.
Let me explain in details:
I got the latest version of dotnetopenauth from github (december 12th)
I ensured to "unblock" the zip before extracting all files.
I opened the solution with VS2012 (under Win7)
When starting the
Sample.Oauth2.OAuthClient project,
the overall build process succeed.
The website is started.
When calling
Sign in with Facebook (OAuth 2.0)
I get
Attempt by method
'DotNetOpenAuth.OAuth2.WebServerClient+d__3.MoveNext()'
to access method
'System.Collections.Generic.List`1..ctor()' failed.
Line 106: // verifiable for the same user/session.
Line 107: // If the host is implementing the authorization tracker
though, they're handling this protection themselves.
Line 108: var cookies = new List();
Line 109: if (this.AuthorizationTracker
== null) {
Line 110: string xsrfKey =
MessagingUtilities.GetNonCryptoRandomDataAsBase64(16, useWeb64: true);
That the provided code is not able to access "System.Collections.Generic.List" bewilders me...
I tried the following :
adding
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
</securityPolicy>
to web.config.
Note that checking just before the line the "CurrentTrustLevel" results in "Unrestricted".
I tried to publish to local IIS 7,
tried running the pool under "administrator"
and finally
I tried with VS2013 on another, "clean" installation of Win7,
All attempts lead to the same result ...
It seems that the errors comes from some System.Net Dlls provided with the samples : they cannot be run by asp.net for security reasons (?)
Any idea ?

Related

The type provider 'ProviderImplementation.JsonProvider' reported an error despite program working

I am writing a service using .net Core with Visual Studio 2017. I want to use JSON for the configuration, so I defined my type like this:
type ServiceConfig = JsonProvider<"exampleConfig.json", EmbeddedResource="MyService, exampleConfig.json", SampleIsList = true>
In my program, I load it like this:
let conf = ServiceConfig.Load "config.json"
When I run it, it works fine, but in VS 2017 I get a red squiggly line and the error log says:
FS3033 The type provider 'ProviderImplementation.JsonProvider'
reported an error in the context of provided type
'FSharp.Data.JsonProvider,Sample="exampleConfig.json",SampleIsList="True",EmbeddedResource="MyService, exampleConfig.json"', member 'Load'. The error: Method
'FSharp.Data.Runtime.BaseTypes.IJsonDocument
Create(System.IO.TextReader, System.String)' not found in type
''. This method may be missing in the types available in the
target assemblies.
How do I get rid of this?
I'm not sure that this is the problem, but it might help to give an absolute path of the sample file. Resolving a relative path is a constant source of issues in type providers. You can do something like:
[<Literal>]
let sample = __SOURCE_DIRECTORY__ + "/exampleConfig.json"
type ServiceConfig =
JsonProvider< sample, EmbeddedResource="MyService, e
xampleConfig.json", SampleIsList = true >
By chance I found the answer myself. It must have been some Visual Studio index having gone wonky. I had another problem with another project in my solution so I just did an "emergency commit" to git, cleaned my local working copy using git clean -fdx and then reloaded the solution, rebuilt everything and the errors went away.

Rotativa - QT untested version

Up until now, my Rorativa (latest stable version - 1.6.1) has been working beautifully in my MVC project.
My code was originally
return new Rotativa.ActionAsPdf(string.Format("PrintPage/{0}", id));
and I get a nice happy pdf version of my page
But now I want to do some more advances stuff, so I do this
return new Rotativa.ActionAsPdf(string.Format("PrintPage/{0}", id))
{
CustomSwitches = "--print-media-type --footer-html " + Url.Action("Footer",id)
};
and then when I do I get this error
Qt: Untested Windows version 6.2 detected!
QMetaObject::invokeMethod: No such method WebCore::SocketStreamHandlePrivate::socketSentData()
Error: Failed loading page http:///Invoice/Footer?page=1&section=Account Queries VAT No.
0&title=Ben Dover-Invoice No:
A0120852&subsection=MATERIALS&frompage=1&subsubsection=&topage=2&doctitle=Ben Dover-Invoice No:
A0120852&webpage=http://localhost:2066/Invoice/PrintPage/386&time=01:01:59 PM&date=2015/01/06
(sometimes it will work just to ignore this error with --load-error-handling ignore)
Error: Failed loading page http:///Invoice/Footer?page=2&section=Account Queries VAT No.
0&title=Ben Dover-Invoice No: A0120852&subsection=TOTAL R
1รก850.70&frompage=1&subsubsection=&topage=2&doctitle=Ben Dover-Invoice No:
A0120852&webpage=http://localhost:2066/Invoice/PrintPage/386&time=01:01:59 PM&date=2015/01/06
(sometimes it will work just to ignore this error with --load-error-handling ignore)
QPaintDevice: Cannot destroy paint device that is being painted
pure virtual method called
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
terminate called without an active exception
I tried following the suggestion and add --load-error-handling ignore this removes the error, but my footer doesn't load
We have the same problem on the project. Additionally report work on localhost but not in production server. Solution for the problem is to add route, so the static IP address will be represented as local on the server.
http://technet.microsoft.com/en-us/library/cc757323%28v=ws.10%29.aspx
On some servers that can not be added for some reasons so we add Microsoft loopback adapter to do the same thing.
https://4sysops.com/archives/how-to-install-loopback-adapter-in-windows-8/
After that everything works perfectly.

ServiceStack F# sample fails starting

I'm trying to run this Self Hosting example, using latest ServiceStack release (4.0.3) and latest Mono/F# (3.2.5).
It fails with an exception on appHost.Init():
{ System.IO.FileNotFoundException: Virtual file not found File name: '<>.FSharpSignatureData.'
at ServiceStack.VirtualPath.ResourceVirtualDirectory.CreateVirtualFile (System.String resourceName) [0x00033] in <>/ServiceStack/VirtualPath/ResourceVirtualDirectory.cs:99 } System.IO.FileNotFoundException
The same does not happen with the C# sample.
Apparently, it looks for some files added as resources in F# assemblies but not mapped to a physical file.
F# does some 'meta data caching' that puts resources (FSharpSignatureData, FSharpOptimizationData) into the assembly. This causes issues when ServiceStack sets up its virtual file system since it wants to map these resources to actual files (I think).
You can get past this by adding the flag --nointerfacedata to the build/compile steps. (in VS Properties > Build > 'Other flags')
I've been meaning to post this to the GitHub issues page.

error in running transformation:indexoutofrangeexception - petapeco

as per suggestion for by #CreativeManix I started investigating petaPeco
Retrieving large number of rows (more than 10 mil) in asp.net mvc application
After adding exact system.data.oracleclient + putting web.config in the bin where mvc is getting compiled in .dll I got following error:
Error 3
Running transformation: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices)
at System.Array.GetValue(Int32 index)
at Microsoft.VisualStudio.TextTemplating5F4490FB7AE018243DBB4DF6250E7211.GeneratedTextTransformation.GetCurrentProject()
at Microsoft.VisualStudio.TextTemplating5F4490FB7AE018243DBB4DF6250E7211.GeneratedTextTransformation.GetConnectionString(String& connectionStringName, String& providerName)
at Microsoft.VisualStudio.TextTemplating5F4490FB7AE018243DBB4DF6250E7211.GeneratedTextTransformation.InitConnectionString()
at Microsoft.VisualStudio.TextTemplating5F4490FB7AE018243DBB4DF6250E7211.GeneratedTextTransformation.LoadTables()
at Microsoft.VisualStudio.TextTemplating5F4490FB7AE018243DBB4DF6250E7211.GeneratedTextTransformation.TransformText()
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)
This error shows up when i run the transformation after installation of petaPoco.
One thing I do know the error is coming from "GetCurrentProject" - and probably - "(Array)dte.ActiveSolutionProjects"
I think something is wrong in the way petaPoco is set up with my project! somehow it can't find the activesolution project. I am not too sure how to fix it.
I investigated this.
In my question section I asked few questions:
I was not sure about how to fire transformation/or process of generating Database.CS. So initially I was installing petapoco from the command prompt- I
To do that you just click "Run Custom Tool" by right clicking on the "Database.tt". If your connection string is correct + you are referencing correct Oracle/SQL server data provider + that provider is available in GAC + (if it is oracle and you have the password for the default schema user of the database you are trying to access)- then that should generate the Database.cs
To enable Oracle data client to read the schema out of oracle database I needed to take out following entry:
cmd.GetType().GetProperty("BindByName").SetValue(cmd, true, null);
And everything worked.
Connection string can look like:
connectionString="Data Source=PXWREG;Persist Security Info=True;User ID=XWREG_ACDS_T;password=isacdst"

WSDL Endpoint example throwing errors in Mule

Posting here is always my last resort, but I'm going crazy here. I'm a Mule ESB beginner. I've been trying to do some simple examples to get me on the right track.
But I've encountered a problem with one of the examples I've seen on the mule website...
http://www.mulesoft.org/documentation/display/current/WSDL+Connectors
I'm trying to set up a generic WSDL endpoint, which invokes a web service without generating a client.
The WSDL I'm trying to access...
http://www.webservicex.net/CurrencyConvertor.asmx?WSDL&method=ConversionRate
The problem is, I keep getting the following error
[ERROR] IOException during exec() of compiler "javac". Check your path environment variable.
ERROR 2013-04-19 09:27:07,920 [[soap].soapFlow1.stage1.02] org.apache.cxf.endpoint.dynamic.DynamicClientFactory: Could not compile java files for http://www.webservicex.net/CurrencyConvertor.asmx?WSDL&method=ConversionRate?wsdl.
ERROR 2013-04-19 09:27:07,934 [[soap].soapFlow1.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Unable to create JAXBContext for generated packages: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (java.lang.IllegalStateException)
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (javax.xml.bind.JAXBException)
com.sun.xml.bind.v2.ContextFactory:183 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/bind/JAXBException.html)
2. Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (javax.xml.bind.JAXBException)
javax.xml.bind.ContextFinder:-1 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/bind/JAXBException.html)
3. Unable to create JAXBContext for generated packages: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (java.lang.IllegalStateException)
org.apache.cxf.endpoint.dynamic.DynamicClientFactory:363 (null)
4. Unable to create JAXBContext for generated packages: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (java.lang.IllegalStateException) (org.mule.api.DefaultMuleException)
org.mule.module.cxf.builder.AbstractOutboundMessageProcessorBuilder:96 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/DefaultMuleException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
And yes, I've hunted around the internet for hours looking for a solution.
Things I've done to try fix the problem.
Make sure the javac path is set in the environment variables.
(%JAVA_HOME%\bin)
Make sure that mule studio has the correct path to JRE
I know it's a simple problem, but I need to figure it out to tackle a larger project that I have in mind.
If anyone could shed some light on a solution this problem, then I'd be extremely grateful.
Thanks :)
Other info:
Using Java 1.7
Using MuleStudio 3.4
Ok, after trying and failing at many different solutions, I've figured it out.
I've seen a lot of people asking the same question as me, with very few solutions.
Here is mine...
The JRE was incorrect.
My java directory consisted of..
And Mule studio was using the folder jre7
So I changed it to use the JRE in the directory jdk1.7.0_17/jre
Ran it again and.. OMG it worked!!
Here is how to do it in mule studio/eclipse...Right Click on your Project --> Properties --> Java Build Path --> Libraries Tab --> Click JRE System Library --> Press Edit --> Click Alternate JRE --> Click Installed JREs.. --> Then Add the JRE from the correct directory like I stated above.
Hope this helps anyone with the same problem! :)

Resources