Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xWebsite binding failing in pull mode #269

Open
subbunori opened this issue Dec 15, 2016 · 7 comments
Open

xWebsite binding failing in pull mode #269

subbunori opened this issue Dec 15, 2016 · 7 comments
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@subbunori
Copy link

Hi,
I am using xWebsite with Azure Automation DSC to setup a server and I see the below error.

"ErrorRecord": "Failure to add certificate to web binding. Please make sure that the certificate thumbprint "" is valid. Error: "Value does not fall within the expected range.".",

It works fine if I use it in push mode though.
Am I missing anything?

xWebSite WebSite
            {
                Ensure = "Present"
                Name = "TestDSC"
                ApplicationPool = "TestDSC"
                PhysicalPath = "D:\Inetpub"
                BindingInfo = @(
                                    MSFT_xWebBindingInformation
                                    {
                                        Protocol              = "HTTPS"
                                        Port                  = "9443"
                                        CertificateThumbprint = "‎‎<my cert thumbprint here>"
                                    }
                                )
            }

When I used dsc debug, I found that it is throwing error exactly at $binding.addsslcertificate call below.

image

@subbunori subbunori changed the title xWebsite bindings fail in pull mode xWebsite binding failing in pull mode Dec 15, 2016
@JonosGit
Copy link

Pretty sure you need to include the Certificate Store Name? At least in the version I am using. BindingInfo = @(
MSFT_xWebBindingInformation
{
Protocol = "HTTPS"
Port = 8443
CertificateThumbprint = "71AD93562316F21F74606F1096B85D66289ED60F"
CertificateStoreName = "WebHosting"
},

@subbunori
Copy link
Author

@JonosGit Thanks for responding.
MY is a default value as mentioned in Convert-To-WebBinding method.
I do have my cert in MY.
And yes, I did try explicitly mentioning MY but it is the same error.

 if ([String]::IsNullOrEmpty($binding.CertificateStoreName))
                    {
                        $certificateStoreName = 'MY'
                        Write-Verbose -Message `
                            ($LocalizedData.VerboseConvertToWebBindingDefaultCertificateStoreName `
                            -f $certificateStoreName)
                    }

@subbunori
Copy link
Author

Any help here?
I used debugging to narrow down to exactly which statement is giving this error.
The thumbprint is fine and when I take this statement and run it myself, it works fine.
It only fails when running in pull mode (with Azure Automation DSC). It runs under system account with both push and pull mode, so what are some other differences I need to know here?

Function : Update-WebsiteBinding
Statement : $methodInstance.Execute()

stack trace is

writeErrorStream : True
Exception : System.Management.Automation.MethodInvocationException: Exception calling "Execute" with "0"
argument(s): "Value does not fall within the expected range." ---> System.ArgumentException:
Value does not fall within the expected range.
at Microsoft.IIs.PowerShell.Framework.Interop.IAppHostMethodInstance.Execute()
at CallSite.Target(Closure , CallSite , Object )
--- End of inner exception stack trace ---
at
System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception
exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo memberInfo)
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : ArgumentException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Update-WebsiteBinding, C:\Program Files\WindowsPowerShell\Modules\xWebAdministration\1.15.0.0
\DscResources\MSFT_xWebsite\MSFT_xWebsite.psm1: line 2074
at Set-TargetResource, C:\Program Files\WindowsPowerShell\Modules\xWebAdministration\1.15.0.0\Ds
cResources\MSFT_xWebsite\MSFT_xWebsite.psm1: line 284
PipelineIterationInfo : {}
PSMessageDetails :

@nzspambot
Copy link

@subbunori I will investigate this and get back to you

@johlju
Copy link
Member

johlju commented Apr 26, 2018

@subbunori did you get an answer to this issue?

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Apr 26, 2018
@subbunori
Copy link
Author

subbunori commented Apr 26, 2018 via email

@johlju
Copy link
Member

johlju commented Apr 26, 2018

@subbunori Thanks for answering after such a long time! Do you still have this problem or did you find a solution by yourself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

4 participants