locked
C# asp.net deployment on IIS express word and excel docs don’t load but images do. On Localhost its all perfect? RRS feed

  • Question

  • User-544325736 posted

    Hello everyone,

    I inherited a project from a previous employee who is no longer with us. Its in C# and Asp.Net Forms. I did some coding on it and I have everything working perfectly when I run it local host.

    He has it deployed on IIS express before to have it working for what he needed it to do.

    Now when I go to post it on IIS normal version 1 of the pages does not load it just keeps the ajax spinner spinning nonstop. The page uses SignalR to load documents (click on 1 and it shows on the page) .docx, xlx, jpg …

    Now when I go to run the site in IIS express like he did the page works. BUT I look at my VM in the cmd window it shows whats going on with IIS express. All jpg images load and show BUT when I load a word doc or excel file I get a message “The directory name isn’t valid.”

    Again on localhost everything works perfectly… IIS express I get that message on a word doc or excel but images work. And normal IIS the ajax loader never stops spinning…

    Wednesday, April 22, 2020 1:59 PM

All replies

  • User753101303 posted

    Hi,

    The directory name isn’t valid.

    You should look at the full exception details to get "at MyNameSpace.MyMethodName" to know where it happens and look at the relevant code.

    Seems you have a directory name somewhere that should be properly configured (path to those  files are stored in a database ?) or that could be hardcoded ?

    At worst it can happen that it needs to be entirely reworked (rare but sometimes you see someone that mistakenly think a web server have access to client side drives which works on localhost but breaks as soon as the app is deployed on a real server)

    Wednesday, April 22, 2020 2:13 PM
  • User-544325736 posted

    I dont get any errors in my code.

    Just the screen ajax loading spinner constantly spins

    and my 'cmd' IIS Express on the VM shows the line 'The directory name isnt valid'

    Wednesday, April 22, 2020 4:38 PM
  • User409696431 posted

    What is the directory name?

    Wednesday, April 22, 2020 5:02 PM
  • User753101303 posted

    Do you mean you see this message when you are logged on the server and doing the thing that "doesn't work"?

    Could it be that you are using Process.Start to open a document using a path on your local machine? It won't work on a real web server as it happens on the server side (it seems fine on a development machine because it is both the client and the web server).

    If this an exception I would expect something such as:

    Unhandled Exception: System.AggregateException: One or more errors occurred. ---
    > System.IO.IOException: The directory name is invalid.
    
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.Path.InternalGetTempFileName(Boolean checkHost)
    at WhatEver.MyMethod() etc...

    which can help also to nderstand where and why it happens (for example here it could be triggered by a bad temp folder configuration though in your case I suspect the problem is really bad path in your code.

    Wednesday, April 22, 2020 5:10 PM
  • User-544325736 posted

    I wish i could use gotoassist to have 1 of yous look at this.

    what is really weird now is..

    so the person that made this code he has a published solution where it all works on IIS express. I got the code it cant be the published solution he had so its a lil behind. I coded it and got it working all the code (except this directory part with word docs and excel files) 

    When i publish it and deploy it so IIS Express all PDFs and images load that are in this directory. there are word docs and excels also in this directory and this is where the error in the cmd window of iis express shows.

    on normal IIS this page doesnt load so nothing works thats why im using IIS express which is what he originally had it working on. 

    When I use localhost the project fully works but when deployed to server I dont get any errors in the Browser Dev Tools nor in the network tab. Only in the 'cmd' that i ran the IIS express commands in i get that 1 error 

    Wednesday, April 22, 2020 5:17 PM
  • User-544325736 posted

    LOOK WHAT I FOUND

    jquery.signalR-2.2.2.min.js:9 WebSocket connection to 'ws://app07/webapps/signalr/reconnect?transport=webSockets&messageId=d-2E1FCC61-E%2C0%7CH%2CD%7CI%2C1&clientProtocol=1.5&connectionToken=InCHghBdgPvFGF3t4CKpjagXvZ6oToObpz0XXmSmFdatKX04xMillqZP4RxsSned%2FAmo3JsS30R50JX7BhSGR2k3pm%2Fvnu2fUt2UiqZSVPkNx8%2FZ2rHVLY70BWWChTeb&connectionData=%5B%7B%22name%22%3A%22schematictrackerhub%22%7D%5D&tid=9' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
    start @ jquery.signalR-2.2.2.min.js:9
    (anonymous) @ jquery.signalR-2.2.2.min.js:9
    Wednesday, April 22, 2020 5:22 PM
  • User409696431 posted

    Refer to this link:

    https://proxus.dk/Blog/Post/2014/07/17/developing-and-deploying-a-signalr-chat-web-app-to-iis

    And note the following:

    "The next thing to note is the MapSignalR method call. By default, VS just uses the MapSignalR method without any parameters, and this works well - when developing on running locally, but I have got it to work in a production IIS. Therefore the manually mapping path used for SignalR."

    VS locally would be IIS Express, and there is a change in the startup.cs file to make it work on full IIS.

    See what you have in your app.MapSignalR call in the startup.cs file, and compare it to what is shown in the link.

    Wednesday, April 22, 2020 8:40 PM
  • User-544325736 posted

    I have never used SignalR before, I inherited this project. In my 'Startup,cs' I found that method call you mentioned. Here it is

     public void Configuration(IAppBuilder app) {
                ConfigureAuth(app);
                app.MapSignalR();
    
    
                Services.SQLService.Initalize();
    
            }

    in my .aspx page I have 

    <script src="signalr/hubs"></script>

    and on the post it uses 'hub' 

    but when I try hub my signalR doesnt work at all on the page.

    I dont really think this is the issue because it says the directory is not valid only when i run word and excel files, but images coming from the same folder work with signalR

    Friday, April 24, 2020 4:52 PM
  • User409696431 posted

    Did you read the link?

    You have a parameterless call to app.MapSignalR() which works with VS and IIS express.  You need parameters for IIS.  It's up to you to know what the parameters should be.  The example uses:

    app.MapSignalR("/~/signalr", new HubConfiguration());
    Friday, April 24, 2020 7:23 PM
  • User-544325736 posted

    So going back to this.. Still not able to open a .docx or excel file in the web browser with IIS and IIS Express on a deployed website. On my local version while running it all works.

    I am starting to think that my code is correct, the error i get is "The Directory Name isn't valid."

    I can open the files locally but not when deployed. I'm starting to think because of this maybe it is some kind of permissions issue or something like that? The previous developer had this working at 1 point but i dont have his most recent deployed code. I tried adding the 

    //$.connection.hub.start("~/signalr").done(function () { to run in normal IIS and I get the 'signalr.js error about the hub file not being created

    Tuesday, April 28, 2020 10:11 PM
  • User475983607 posted

    So going back to this.. Still not able to open a .docx or excel file in the web browser with IIS and IIS Express on a deployed website. On my local version while running it all works.

    There is no guarantee a user can open Word or Excel in a web browser.    The user must have Word and Excel installed plus a browser plugin.  Are you sure the server is not opening the files which makes it seem like the design is working in development?    

    Tuesday, April 28, 2020 10:37 PM
  • User-544325736 posted

    The server has to have microsoft office installed which it does.

    When I click the link on client the server does open a excel or word doc and closes it quickly then on the pc it opens (on the working copy) but on the copy with the updated methods and stuff that is needed  the page just keeps spinning and on the IIS express 'cmd' i get the error message directory not valid.

    Wednesday, April 29, 2020 1:54 PM
  • User753101303 posted

    The server has to have microsoft office installed which it does.

    Seems to confirm what I said earlier ie that you are trying to open the Word or Excel on the web server where the user will be absolutely unable to interact with that. Could you show the few lines of code used to "launch" Word or Excel? My guess is that it is using Process.Start. Please do show how it is done.

    It appears to work on your own machine because it is both the web browser and the web server side which gives sometimes an unclear idea about what runs where.

    Wednesday, April 29, 2020 2:54 PM
  • User-544325736 posted

    So I have a published code all the .dlls and everything where everything works...
    Its just a version where I do not have the source code.

    I need to add some functionality to it I have a older version of all of the source code. My version I have when I publish it is where I get these issues/errors.

    I dont fully understand signalR have never used it. so debugging it going through dev tools and the debugger.

    btn click enter the # to search upon

        $('#InputSerialNumber').keyup(function (e) {
            if (e.keyCode == 13) {
                SerialSubmit(this);
            }
        });

    assuming need this 

    var chat = $.connection.schematicTrackerHub;
    
    //	APP07 'Direcotry issue ?'
    $.connection.hub.start().done(function () {
    //$.connection.hub.start("~/signalr").done(function () {
    
        if ($('#InputSerialNumber').val().length > 0) {
            SerialSubmit(this);
        }
        else {
            $("#SerialHeader").slideDown(350);
        }
    
    });
    chat.client.hubReceiveCustomerInfo = function (message) {
        demo().then(function callback(){
        
            var obj = $.parseJSON(message);
    
            var keys = Object.keys(obj);
    
            var machineTrackerHref = $('#machineTracker').attr("href");
            $('#machineTracker').attr("href", machineTrackerHref + "?SN=" + obj["Serial Number"]);
    
            var serviceTrackerHref = $('#serviceTracker').attr("href");
            $('#serviceTracker').attr("href", serviceTrackerHref + "?SN=" + obj["Serial Number"]);
    
            $.each(keys, function (key) {
                var idName = keys[key].replace(/\s+/g, '');
                idName = idName.replace(/\(.*?\)/, '');
                idName = idName.replace('#', '');
                idName = idName.replace('/', '');
                
                if (idName.indexOf("/") < 0) {
    
                    var newIdNames = ["", ""];
    
                    //header data
                    if ($('#' + idName).length) {
                        newIdNames[0] = '#' + idName;
                    }
                    //grid data
                    if ($('#' + idName + 'Grid').length) {
                        newIdNames[1] = '#' + idName + 'Grid';
                    }           
    
                    $.each(newIdNames, function (index, value) {
                        if (value.length > 0) {
    
                            var elementType = $(value).get(0).tagName;
                            if (elementType == 'INPUT' || elementType == 'TEXTAREA') {
                                $(value).val(obj[keys[key]]);
                            }
                            if (elementType == 'DIV' || elementType == 'SPAN') {
                                $(value).text(obj[keys[key]]);
                            }
                        }
                    });
                }
    
            });
            $('#TabControl').slideDown(500);
    
            if (!headerClosed){
                $('#HeaderControl').slideDown(500);
            }
            $('#telephoneRecords').show();
            $("#telephoneRecords").slideDown(150);
            Materialize.updateTextFields();
            $('ul.tabs').tabs({
                swipeable: true,
            });
    
            $('.tabs-content.carousel').height('');
        });
    };
    function SerialSubmit(sender) {
        $("#pleaseWaitContext").text("Loading...");
        
        $('#loadWindow').show();
    
        chat.server.inputSerialNumberDataReceived(sender.id, sender.baseURI, $.connection.hub.id, $('#InputSerialNumber').val());
        $("#SerialHeader").slideUp(350);
    }

    and here is where it must connect JavaScript signalR to C#

            public void InputSerialNumberDataReceived(object ID, object URI, object ConnectionID, object data)
            {
                var serverVars = Context.Request.GetHttpContext().Request.ServerVariables;
                var Ip = serverVars["REMOTE_ADDR"];
    
                Console.WriteLine("SchematicTracker Connecting IP= " + Ip);
    
                try
                {
                    SN = Convert.ToInt32((string)data);
    
                    var serializedData = MachineLogic.GetCustomerInfo(SN);
    
                    Clients.Client((string)ConnectionID).hubReceiveCustomerInfo(serializedData);
    
                    GetPDFNames(ID, URI, ConnectionID, data, SN);
    
                }
                catch (Exception oe)
                {
                    Clients.Client((string)ConnectionID).hubErrorOccurred(oe.Message.ToString());
                }
            }
    
            public void GetPDFNames(object ID, object URI, object ConnectionID, object data, int SerialNumber)
            {
                try
                {
                    Database.qryMachines machineAll = MachineTrackerDB.qryMachines.FirstOrDefault(x => x.SN2 == SerialNumber);
    
                    Database.Customer customerInfo = MachineTrackerDB.Customer.FirstOrDefault(x => x.ID == machineAll.CustomerID);
    
                    List<PdfObject> pdfObjs = new List<PdfObject>();
                    List<string> allowedExtensions = new List<string> { ".pdf", ".doc", ".docx", ".xls", ".xlsx", };
                    List<string> listOfAllPDFs = new List<string>();
                    try
                    {
                        Clients.Client((string)ConnectionID).hubReceiveLoadingUpdate("Fetching Tool Group...");
    
                        var docs = Directory.GetFiles(@"\\file01\\MachineData\\1 Engineering\\" + machineAll.WorkOrder + "\\06 Tool Group Specification\\", "*.*").Where(x => allowedExtensions.Contains(Path.GetExtension(x))).ToList();
                        foreach (var item in docs)
                        {
                            if (!listOfAllPDFs.Any(x => x.Contains(item.Substring(0, item.LastIndexOf(".")))))
                                listOfAllPDFs.Add(item);
                        }
    
                    }
                    catch { }
    
                    try
                    {
                        Clients.Client((string)ConnectionID).hubReceiveLoadingUpdate("Fetching Sales Order...");
                        listOfAllPDFs.AddRange(Directory.GetFiles(@"\\file01\\Machinedata\\0 Sales\\" + machineAll.WorkOrder + "\\01 Order Entry Documents (Current)\\").Where(x => allowedExtensions.Contains(Path.GetExtension(x))).ToList());
                    }
                    catch { }
    
                    try
                    {
                        Clients.Client((string)ConnectionID).hubReceiveLoadingUpdate("Fetching Top Level...");
    
                        listOfAllPDFs.AddRange(Directory.GetFiles(@"\\file01\\Public1\\Eng Files .pdf\\" + machineAll.Schematic.Substring(0, 4) + "\\", "*.*")
                                .Where(x => allowedExtensions.Contains(Path.GetExtension(x)) && x.Contains(machineAll.Schematic.ToString())).ToList());
                    }
                    catch { }
    
                    Clients.Client((string)ConnectionID).hubReceiveLoadingUpdate("Searching LN for wiring schematics...");
    
                    List<Database.ttibom010200> machineWiringSets = LNDB.ttibom010200.Where(x => x.t_mitm.Contains(machineAll.Schematic.ToString())).OrderBy(x => x.t_exin).ToList();
    
                    Clients.Client((string)ConnectionID).hubReceiveLoadingUpdate("Finding all machine wiring schematics...");
    
                    int totalSets = machineWiringSets.Count;
    
                    foreach (Database.ttibom010200 set in machineWiringSets)
                    {
                        Clients.Client((string)ConnectionID).hubReceiveLoadingUpdate("Finding all machine wiring schematics.... " + (machineWiringSets.Count - totalSets) + " of " + machineWiringSets.Count + " processed");
    
                        try
                        {
                            listOfAllPDFs.AddRange(Directory.GetFiles(@"\\file01\\Public1\\Eng Files .pdf\\" + set.t_sitm.Replace(" ", "").Substring(0, 4) + "\\", "*.*")
                                .Where(x => allowedExtensions.Contains(Path.GetExtension(x)) && x.Contains(set.t_sitm.Replace(" ", "").ToString())).ToList());
                        }
                        catch { }
                        totalSets--;
                    }
    
                    foreach (string pdf in listOfAllPDFs)
                    {
                        var uri = new System.Uri(pdf);
                        var converted = uri.AbsoluteUri;
    
                        //var test = uri.LocalPath;
    
                        pdfObjs.Add(new PdfObject()
                        {
                            Name = Path.GetFileNameWithoutExtension(pdf),
                            Path = converted,
                        });
                    }
    
                    if (pdfObjs.Count > 0)
                        Clients.Client((string)ConnectionID).hubReceivePdfList(JsonConvert.SerializeObject(pdfObjs));
                }
                catch (Exception oe)
                {
                    Clients.Client((string)ConnectionID).hubErrorOccurred(oe.Message.ToString());
                }
            }

    Wednesday, April 29, 2020 4:55 PM
  • User475983607 posted

    I think you misunderstand how the code works.   The code returns, or at least tries to return, a list of  paths to the browser.  Form your description it sounds like you are at the point where you can see the links.   If I understand correctly, clicking a link attempts to open the file in a modal.  This causes "The directory name isn’t valid" error.

    The first thing you should do, is review the links in the browser's Dev Tools.   Make sure the paths are correct.  An easy way to verify is copying the path and pasting it in Windows Explorer.   If you cannot open the file then you might not have access to the path or the path is simply wrong.  If you can open the file then your browser is either missing a plugin or browser security is blocking the file. 

    Wednesday, April 29, 2020 7:44 PM
  • User-544325736 posted

    After more debugging i found that all the code i posted above is working.

    Where the error comes in is when i have the list of documents and i click one and having it show up on the page. I'm currently debugging it on local host because everything runs there so i understand how the program works. I will do as you said on the deployed version just unsure if i will be able to see the path in the javascript code.

    Here is the beginning clicking on a document

     $('#nav-right').on('click', function (event) {
            if (event.target != this && event.target.className != "material-icons") {
                //alert('You clicked a descendent of #container.');
    			$("#pleaseWaitContext").text("Loading" + $(event.target).contents().filter(function(){return this.nodeType == 3; })[0].nodeValue);
                $('#loadWindow').show();
                $('#ErrorControl').empty();
                $('#ErrorControl').hide();
                var arrayOfButtons = $('#nav-right').find('a').css('background-color', '');
                var uriOfSelectedButton = event.target.uri;
    
                chat.server.fetchPrint(event.target.id, event.target.baseURI, $.connection.hub.id, uriOfSelectedButton);
                //console.log(uriOfSelectedButton);
                $(event.target).css('background-color', 'lightblue');
    
            } else {
                //alert('You actually clicked #container itself.');
            }
            if (event.target.className == "material-icons"){
                var uriOfSelectedButton = event.target.uri;
    
                var uriArray = uriOfSelectedButton.split('/');
                if (uriArray.length >= 3){
    
    
    
                    uriArray = jQuery.grep(uriArray, function(value){
                        //value != 'file:';
                        return value != 'file:';
                            
                    });
    
                    uriArray = jQuery.grep(uriArray, function(value){
                        //value != 'file:';
                        return value != 'file01';
                            
                    });
    
                    var newpath = uriArray.join('/');
                    
    
                    var url = window.location.href;
                    var hostname = get_hostname(url);
                    //var serverPath = url.replace(window.location.pathname, "");
    
                    window.open(hostname + '/PDFWindow?Sheet=' + newpath);
    
    
                }
                
            }
        });

    Next is the C#

     public void FetchPrint(object ID, object URI, object ConnectionID, object data)
            {
                if (data == null)
                    return;
    
    
    
                Byte[] bytes = null;
                var uri = new System.Uri(data.ToString());
                var localPath = uri.LocalPath;
                var pathExtension = Path.GetExtension(localPath);
                if (pathExtension[1].ToString().ToLower().Contains("d"))
                {
                    Guid docGuid = Guid.NewGuid();
                    var tempPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                    tempPath = System.IO.Path.GetDirectoryName(tempPath) + @"\pdf_temp\" + docGuid.ToString() + ".pdf";
                    WordConverter.ConvertWord(localPath, tempPath);
    
                    var uriPath = new System.Uri(tempPath).LocalPath;
                    bytes = File.ReadAllBytes(uriPath);
                    File.Delete(uriPath);
                }
                else if (pathExtension[1].ToString().ToLower().Contains("x"))
                {
                    Guid excelGuid = Guid.NewGuid();
                    var tempPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                    tempPath = System.IO.Path.GetDirectoryName(tempPath) + @"\pdf_temp\" + excelGuid.ToString() + ".pdf";
                    ExcelConverter.ConvertExcel(localPath, tempPath);
    
                    var uriPath = new System.Uri(tempPath).LocalPath;
                    bytes = File.ReadAllBytes(uriPath);
                    File.Delete(uriPath);
                }
                else
                {
                    bytes = File.ReadAllBytes(localPath);
    
                }
    
                if (bytes != null)
                {
                    String pdfString = Convert.ToBase64String(bytes);
                    Clients.Client((string)ConnectionID).hubReceivePdf(pdfString);
                }
    
            }
    
            public void FetchPrintOpenWindow(object ID, object URI, object ConnectionID, object data)
            {
                if (data == null)
                    return;
    
                var uri = new System.Uri(data.ToString());
                var localPath = uri.LocalPath;
    
                Byte[] bytes = File.ReadAllBytes(localPath);
                String pdfString = Convert.ToBase64String(bytes);
    
                Clients.Client((string)ConnectionID).hubReceivePdfOpenWindow(pdfString);
    
            }

    In this code above is where the issue lies

    Wednesday, April 29, 2020 8:01 PM
  • User753101303 posted

    I managed to get a "Directory name is invalid" message when giving an existing file name to Directoty.GetFiles.

    What makes this hard to debug is that we don't know yet exactly where it happens. Using ex.Message shows just "Directory name is invalid" while ex.ToString() would show:

    System.IO.IOException: Directory name is invalid
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileSystemEnumerableIterator`1.CommonInit()
       at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
       at System.IO.Directory.GetFiles(String path)    <== THE .NET METHOD YOU CALL
       at ASP._Page_Views_Home_Index_cshtml.Execute()  <== YOUR METHOD (a cshtml page which is actually just C# code)

    I'm still not sure to get where you see this message. If the message comes from the last code you shown and some global even handler or if it could come from one of  the two Clients.Client((string)ConnectionID).hubErrorOccurred(oe.Message.ToString()); line.

    In my experience trying to debug without having enough details first is often much longer. 

    Wednesday, April 29, 2020 10:31 PM
  • User-544325736 posted

    that 'directory  name is invalid' comes from the command prompt in the server vm that I used to run the commands to start IIS express

    every time i go to the url i get messages on the cmd basically saying sending and receiving data.

    When i run the program localhost I can debug the c# 

    the file path its getting is

    '\\file01\\MachineData\\1 Engineering\\150496\06 Tool Group Specification\150496C.pdf'

    this is where its got to be wrong??

     I just dont understand how it works on localhost with that file path

    on the server tho some1 said i should be able to copy the path and have it get the file well that path only works if i remove  the 2nd '\' on the folders

    I am going to code it up to be a normal path to see if this is where the issue is coming from

    Thursday, April 30, 2020 6:18 PM
  • User753101303 posted

    What does hubErrorOccurred ? Could it show an error message on the console? What if you change ex.Message to ex.ToString() to see if it shows some more information. You really work on the exact same database in both cases? 

    ExceedingLife

     I just dont understand how it works on localhost with that file path

    It usually doesn't help at this step. Find where it happens and then add for example tracing processed path to the console and even if needed adding code checking the directory does exists etc... In short each step narrows down what happen until you have enough information to understand exactly what happens. Then you'll likely understand why it was working on localhost and not on the other machine.

    Thursday, April 30, 2020 7:06 PM
  • User-544325736 posted

    I just created the path to be how a path is suppose to look. I get the same issue.

    On the console here is what it looks like.

    Response sent: http://app07:80/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=vNfi6h%2FqpTrFk9uq9xkpLQNexOjA8QZiCqb3hY5cszpUHnmWsv2AaJ%2B47iF%2FG%2FS6EcxfbglvPQ7R3O%2FWQiXC0BAuiGRiWfNiaXVDBlgccJ%2BIAUCKpOvB1KCzN8OfoDnc&connectionData=%5B%7B%22name%22%3A%22schematictrackerhub%22%7D%5D&tid=2 with HTTP status 101.0
    The directory name isn't valid.
    Response sent: http://app07:80/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=vNfi6h%2FqpTrFk9uq9xkpLQNexOjA8QZiCqb3hY5cszpUHnmWsv2AaJ%2B47iF%2FG%2FS6EcxfbglvPQ7R3O%2FWQiXC0BAuiGRiWfNiaXVDBlgccJ%2BIAUCKpOvB1KCzN8OfoDnc&connectionData=%5B%7B%22name%22%3A%22schematictrackerhub%22%7D%5D&tid=2 with HTTP status 101.0
    Response sent: http://app07:80/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=vNfi6h%2FqpTrFk9uq9xkpLQNexOjA8QZiCqb3hY5cszpUHnmWsv2AaJ%2B47iF%2FG%2FS6EcxfbglvPQ7R3O%2FWQiXC0BAuiGRiWfNiaXVDBlgccJ%2BIAUCKpOvB1KCzN8OfoDnc&connectionData=%5B%7B%22name%22%3A%22schematictrackerhub%22%7D%5D&tid=2 with HTTP status 101.0
    Response sent: http://app07:80/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=vNfi6h%2FqpTrFk9uq9xkpLQNexOjA8QZiCqb3hY5cszpUHnmWsv2AaJ%2B47iF%2FG%2FS6EcxfbglvPQ7R3O%2FWQiXC0BAuiGRiWfNiaXVDBlgccJ%2BIAUCKpOvB1KCzN8OfoDnc&connectionData=%5B%7B%22name%22%3A%22schematictrackerhub%22%7D%5D&tid=2 with HTTP status 101.0
    Response sent: http://app07:80/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=vNfi6h%2FqpTrFk9uq9xkpLQNexOjA8QZiCqb3hY5cszpUHnmWsv2AaJ%2B47iF%2FG%2FS6EcxfbglvPQ7R3O%2FWQiXC0BAuiGRiWfNiaXVDBlgccJ%2BIAUCKpOvB1KCzN8OfoDnc&connectionData=%5B%7B%22name%22%3A%22schematictrackerhub%22%7D%5D&tid=2 with HTTP status 101.0

    Ill look for the hubErrorOccurred for you

    If you have like gotoassist or anything we could possibly share screen and you can see the issue 

    Just so you know the method

    public void InputSerialNumberDataReceived(object ID, object URI, object ConnectionID, object data)
    

    finishes without any errors. All it does it grab the name of each document in the directory linked to that project and displays them on the page.

    When you click on a name then the FetchPrint() happens and this is what grabs the document and displays it as a .pdf on the screen.

    This is where the error happens ONLY when a .docx or excel file is suppose to be displayed on the screen. All images and pdf docs display without any issues

    PS. - Changing the line in the catch (Exception oe ) did not change anything in the console window i have running IIS. no more added information

     catch (Exception oe)
                {
                    //Clients.Client((string)ConnectionID).hubErrorOccurred(oe.Message.ToString());
                    Clients.Client((string)ConnectionID).hubErrorOccurred(oe.ToString());
    
                }

    Thursday, April 30, 2020 7:20 PM
  • User475983607 posted

    I'm a bit puzzled why you don't try to open file from the server using Windows explore.   You know the path.   

    All the code you shared up to this point are the requests.  Not once have to shared how the response is handled.  The responses are important because the code clearly caches the file paths in the HTML.  

    I agree with PatriceSc.  You should to do a more thorough debugging job and target the actual problem rather than posted code block hints on the forum that only bring up more questions.

    Thursday, April 30, 2020 10:48 PM