Shared MikTex install on windows server 2012 to generate PDF from IIS











up vote
0
down vote

favorite












I'm trying to install a shared MikTex on a Windows server 2012, so my web application (Perl CGI / IIS 8) can generate PDF files on the fly through pdflatex, and send them to the user.



I managed to install MikTex 2.9.6637 (x64) on the server through full download on another machine and transferring the files (the server has no web access), and it does work from the command line.



However I have trouble when I try to run my command from a Perl / CGI script from the webserver, when I configure IIS to use anonymous authentication through the windows account Network Service: access denied.
When I use IIS windows authentication, and the script runs with my own windows account (admin), it runs fine. Definitely an access management problem.



I used the options found on this page



http://docs.miktex.org/2.9/manual/setupwiz.html



in order to configure all folders in a simple D:miktex_local on which i can grant all privileges to this network service, instead of the default / folders.
The only folder I did not manage to configure myself is the log directory that stays in:
C:ProgramDataMiKTeX2.9miktexlog
But I granted privileges on this one, and it does not seem to be used even when I manage to generate the pdf.



My test script can write in these folders and logs are generated.
I also test from the script that the user has r/w privileges on my in and out folders.



This is the log from a success run (admin user):



2018-03-29 14:14:48,797+0200 INFO  pdflatex - starting with command line: D:miktexmiktexbinx64pdflatex -output-directory=D:testout D:testintoken.tex
2018-03-29 14:14:48,797+0200 WARN pdflatex - running with administrator privileges
2018-03-29 14:14:48,813+0200 INFO pdflatex - allowing known shell commands
2018-03-29 14:14:48,813+0200 INFO pdflatex - enabling input (output) from (to) processes
2018-03-29 14:14:48,813+0200 INFO pdflatex - setting output directory: D:testout
2018-03-29 14:14:48,813+0200 INFO pdflatex - setting aux directory: D:testout
2018-03-29 14:14:49,610+0200 INFO pdflatex - finishing with exit code 0


This the log from a failed run (network service user):



2018-03-29 14:14:19,478+0200 INFO  pdflatex - starting with command line: D:miktexmiktexbinx64pdflatex -output-directory=D:testout D:testintoken.tex
2018-03-29 14:14:19,478+0200 INFO pdflatex - allowing known shell commands
2018-03-29 14:14:19,478+0200 INFO pdflatex - enabling input (output) from (to) processes
2018-03-29 14:14:19,478+0200 INFO pdflatex - setting output directory: D:testout
2018-03-29 14:14:19,478+0200 INFO pdflatex - setting aux directory: D:testout
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Windows API error 5: Access is denied.
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Info: path="D:testintoken.tex"
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Source: LibrariesMiKTeXCorePathNamePathName.cpp
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Line: 156
2018-03-29 14:14:19,509+0200 INFO pdflatex - finishing with exit code 1


There seems to be an acces problem on some resource, but I can't figure out which. My test script running the command is allowed to read the content of the input .tex file, write in the output directory and the log directory, and pdflatex -help gives me no error.



I have already faced a very similar issue with TexLive, working fine when run under administrator account, but giving me a cryptic "fatal: Can't get long name for D:texlive" when run under Network Service.



Any advice or pointers would be welcome, thanks in advance.










share|improve this question














bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • ask at the miktex issue tracker on github.
    – Ulrike Fischer
    Mar 29 at 12:40















up vote
0
down vote

favorite












I'm trying to install a shared MikTex on a Windows server 2012, so my web application (Perl CGI / IIS 8) can generate PDF files on the fly through pdflatex, and send them to the user.



I managed to install MikTex 2.9.6637 (x64) on the server through full download on another machine and transferring the files (the server has no web access), and it does work from the command line.



However I have trouble when I try to run my command from a Perl / CGI script from the webserver, when I configure IIS to use anonymous authentication through the windows account Network Service: access denied.
When I use IIS windows authentication, and the script runs with my own windows account (admin), it runs fine. Definitely an access management problem.



I used the options found on this page



http://docs.miktex.org/2.9/manual/setupwiz.html



in order to configure all folders in a simple D:miktex_local on which i can grant all privileges to this network service, instead of the default / folders.
The only folder I did not manage to configure myself is the log directory that stays in:
C:ProgramDataMiKTeX2.9miktexlog
But I granted privileges on this one, and it does not seem to be used even when I manage to generate the pdf.



My test script can write in these folders and logs are generated.
I also test from the script that the user has r/w privileges on my in and out folders.



This is the log from a success run (admin user):



2018-03-29 14:14:48,797+0200 INFO  pdflatex - starting with command line: D:miktexmiktexbinx64pdflatex -output-directory=D:testout D:testintoken.tex
2018-03-29 14:14:48,797+0200 WARN pdflatex - running with administrator privileges
2018-03-29 14:14:48,813+0200 INFO pdflatex - allowing known shell commands
2018-03-29 14:14:48,813+0200 INFO pdflatex - enabling input (output) from (to) processes
2018-03-29 14:14:48,813+0200 INFO pdflatex - setting output directory: D:testout
2018-03-29 14:14:48,813+0200 INFO pdflatex - setting aux directory: D:testout
2018-03-29 14:14:49,610+0200 INFO pdflatex - finishing with exit code 0


This the log from a failed run (network service user):



2018-03-29 14:14:19,478+0200 INFO  pdflatex - starting with command line: D:miktexmiktexbinx64pdflatex -output-directory=D:testout D:testintoken.tex
2018-03-29 14:14:19,478+0200 INFO pdflatex - allowing known shell commands
2018-03-29 14:14:19,478+0200 INFO pdflatex - enabling input (output) from (to) processes
2018-03-29 14:14:19,478+0200 INFO pdflatex - setting output directory: D:testout
2018-03-29 14:14:19,478+0200 INFO pdflatex - setting aux directory: D:testout
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Windows API error 5: Access is denied.
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Info: path="D:testintoken.tex"
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Source: LibrariesMiKTeXCorePathNamePathName.cpp
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Line: 156
2018-03-29 14:14:19,509+0200 INFO pdflatex - finishing with exit code 1


There seems to be an acces problem on some resource, but I can't figure out which. My test script running the command is allowed to read the content of the input .tex file, write in the output directory and the log directory, and pdflatex -help gives me no error.



I have already faced a very similar issue with TexLive, working fine when run under administrator account, but giving me a cryptic "fatal: Can't get long name for D:texlive" when run under Network Service.



Any advice or pointers would be welcome, thanks in advance.










share|improve this question














bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • ask at the miktex issue tracker on github.
    – Ulrike Fischer
    Mar 29 at 12:40













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to install a shared MikTex on a Windows server 2012, so my web application (Perl CGI / IIS 8) can generate PDF files on the fly through pdflatex, and send them to the user.



I managed to install MikTex 2.9.6637 (x64) on the server through full download on another machine and transferring the files (the server has no web access), and it does work from the command line.



However I have trouble when I try to run my command from a Perl / CGI script from the webserver, when I configure IIS to use anonymous authentication through the windows account Network Service: access denied.
When I use IIS windows authentication, and the script runs with my own windows account (admin), it runs fine. Definitely an access management problem.



I used the options found on this page



http://docs.miktex.org/2.9/manual/setupwiz.html



in order to configure all folders in a simple D:miktex_local on which i can grant all privileges to this network service, instead of the default / folders.
The only folder I did not manage to configure myself is the log directory that stays in:
C:ProgramDataMiKTeX2.9miktexlog
But I granted privileges on this one, and it does not seem to be used even when I manage to generate the pdf.



My test script can write in these folders and logs are generated.
I also test from the script that the user has r/w privileges on my in and out folders.



This is the log from a success run (admin user):



2018-03-29 14:14:48,797+0200 INFO  pdflatex - starting with command line: D:miktexmiktexbinx64pdflatex -output-directory=D:testout D:testintoken.tex
2018-03-29 14:14:48,797+0200 WARN pdflatex - running with administrator privileges
2018-03-29 14:14:48,813+0200 INFO pdflatex - allowing known shell commands
2018-03-29 14:14:48,813+0200 INFO pdflatex - enabling input (output) from (to) processes
2018-03-29 14:14:48,813+0200 INFO pdflatex - setting output directory: D:testout
2018-03-29 14:14:48,813+0200 INFO pdflatex - setting aux directory: D:testout
2018-03-29 14:14:49,610+0200 INFO pdflatex - finishing with exit code 0


This the log from a failed run (network service user):



2018-03-29 14:14:19,478+0200 INFO  pdflatex - starting with command line: D:miktexmiktexbinx64pdflatex -output-directory=D:testout D:testintoken.tex
2018-03-29 14:14:19,478+0200 INFO pdflatex - allowing known shell commands
2018-03-29 14:14:19,478+0200 INFO pdflatex - enabling input (output) from (to) processes
2018-03-29 14:14:19,478+0200 INFO pdflatex - setting output directory: D:testout
2018-03-29 14:14:19,478+0200 INFO pdflatex - setting aux directory: D:testout
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Windows API error 5: Access is denied.
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Info: path="D:testintoken.tex"
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Source: LibrariesMiKTeXCorePathNamePathName.cpp
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Line: 156
2018-03-29 14:14:19,509+0200 INFO pdflatex - finishing with exit code 1


There seems to be an acces problem on some resource, but I can't figure out which. My test script running the command is allowed to read the content of the input .tex file, write in the output directory and the log directory, and pdflatex -help gives me no error.



I have already faced a very similar issue with TexLive, working fine when run under administrator account, but giving me a cryptic "fatal: Can't get long name for D:texlive" when run under Network Service.



Any advice or pointers would be welcome, thanks in advance.










share|improve this question













I'm trying to install a shared MikTex on a Windows server 2012, so my web application (Perl CGI / IIS 8) can generate PDF files on the fly through pdflatex, and send them to the user.



I managed to install MikTex 2.9.6637 (x64) on the server through full download on another machine and transferring the files (the server has no web access), and it does work from the command line.



However I have trouble when I try to run my command from a Perl / CGI script from the webserver, when I configure IIS to use anonymous authentication through the windows account Network Service: access denied.
When I use IIS windows authentication, and the script runs with my own windows account (admin), it runs fine. Definitely an access management problem.



I used the options found on this page



http://docs.miktex.org/2.9/manual/setupwiz.html



in order to configure all folders in a simple D:miktex_local on which i can grant all privileges to this network service, instead of the default / folders.
The only folder I did not manage to configure myself is the log directory that stays in:
C:ProgramDataMiKTeX2.9miktexlog
But I granted privileges on this one, and it does not seem to be used even when I manage to generate the pdf.



My test script can write in these folders and logs are generated.
I also test from the script that the user has r/w privileges on my in and out folders.



This is the log from a success run (admin user):



2018-03-29 14:14:48,797+0200 INFO  pdflatex - starting with command line: D:miktexmiktexbinx64pdflatex -output-directory=D:testout D:testintoken.tex
2018-03-29 14:14:48,797+0200 WARN pdflatex - running with administrator privileges
2018-03-29 14:14:48,813+0200 INFO pdflatex - allowing known shell commands
2018-03-29 14:14:48,813+0200 INFO pdflatex - enabling input (output) from (to) processes
2018-03-29 14:14:48,813+0200 INFO pdflatex - setting output directory: D:testout
2018-03-29 14:14:48,813+0200 INFO pdflatex - setting aux directory: D:testout
2018-03-29 14:14:49,610+0200 INFO pdflatex - finishing with exit code 0


This the log from a failed run (network service user):



2018-03-29 14:14:19,478+0200 INFO  pdflatex - starting with command line: D:miktexmiktexbinx64pdflatex -output-directory=D:testout D:testintoken.tex
2018-03-29 14:14:19,478+0200 INFO pdflatex - allowing known shell commands
2018-03-29 14:14:19,478+0200 INFO pdflatex - enabling input (output) from (to) processes
2018-03-29 14:14:19,478+0200 INFO pdflatex - setting output directory: D:testout
2018-03-29 14:14:19,478+0200 INFO pdflatex - setting aux directory: D:testout
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Windows API error 5: Access is denied.
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Info: path="D:testintoken.tex"
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Source: LibrariesMiKTeXCorePathNamePathName.cpp
2018-03-29 14:14:19,509+0200 FATAL pdflatex - Line: 156
2018-03-29 14:14:19,509+0200 INFO pdflatex - finishing with exit code 1


There seems to be an acces problem on some resource, but I can't figure out which. My test script running the command is allowed to read the content of the input .tex file, write in the output directory and the log directory, and pdflatex -help gives me no error.



I have already faced a very similar issue with TexLive, working fine when run under administrator account, but giving me a cryptic "fatal: Can't get long name for D:texlive" when run under Network Service.



Any advice or pointers would be welcome, thanks in advance.







installing windows filesystem-access






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 29 at 12:37









Spendius

1




1





bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • ask at the miktex issue tracker on github.
    – Ulrike Fischer
    Mar 29 at 12:40


















  • ask at the miktex issue tracker on github.
    – Ulrike Fischer
    Mar 29 at 12:40
















ask at the miktex issue tracker on github.
– Ulrike Fischer
Mar 29 at 12:40




ask at the miktex issue tracker on github.
– Ulrike Fischer
Mar 29 at 12:40










1 Answer
1






active

oldest

votes

















up vote
0
down vote













I got it.
I believe the error to originate from the same issue as texlive, from this line:



DWORD len = GetLongPathNameW(this->ToWideCharString().c_str(), longPathName, _MAX_PATH);



Turns out I have to give relative paths to my pdflatex command, for some reason it does not support absolute paths when ran from this network service account.
I moved my test/in and test/out in the wwwroot and it works after this small change:
D:miktexmiktexbinx64pdflatex -output-directory=texout texintoken.tex






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f423845%2fshared-miktex-install-on-windows-server-2012-to-generate-pdf-from-iis%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    I got it.
    I believe the error to originate from the same issue as texlive, from this line:



    DWORD len = GetLongPathNameW(this->ToWideCharString().c_str(), longPathName, _MAX_PATH);



    Turns out I have to give relative paths to my pdflatex command, for some reason it does not support absolute paths when ran from this network service account.
    I moved my test/in and test/out in the wwwroot and it works after this small change:
    D:miktexmiktexbinx64pdflatex -output-directory=texout texintoken.tex






    share|improve this answer

























      up vote
      0
      down vote













      I got it.
      I believe the error to originate from the same issue as texlive, from this line:



      DWORD len = GetLongPathNameW(this->ToWideCharString().c_str(), longPathName, _MAX_PATH);



      Turns out I have to give relative paths to my pdflatex command, for some reason it does not support absolute paths when ran from this network service account.
      I moved my test/in and test/out in the wwwroot and it works after this small change:
      D:miktexmiktexbinx64pdflatex -output-directory=texout texintoken.tex






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        I got it.
        I believe the error to originate from the same issue as texlive, from this line:



        DWORD len = GetLongPathNameW(this->ToWideCharString().c_str(), longPathName, _MAX_PATH);



        Turns out I have to give relative paths to my pdflatex command, for some reason it does not support absolute paths when ran from this network service account.
        I moved my test/in and test/out in the wwwroot and it works after this small change:
        D:miktexmiktexbinx64pdflatex -output-directory=texout texintoken.tex






        share|improve this answer












        I got it.
        I believe the error to originate from the same issue as texlive, from this line:



        DWORD len = GetLongPathNameW(this->ToWideCharString().c_str(), longPathName, _MAX_PATH);



        Turns out I have to give relative paths to my pdflatex command, for some reason it does not support absolute paths when ran from this network service account.
        I moved my test/in and test/out in the wwwroot and it works after this small change:
        D:miktexmiktexbinx64pdflatex -output-directory=texout texintoken.tex







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 29 at 13:13









        Spendius

        1




        1






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f423845%2fshared-miktex-install-on-windows-server-2012-to-generate-pdf-from-iis%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks