NotFound Error on Upload, 0 Bytes on Download

Jan 26, 2012 at 12:11 AM
Edited Jan 26, 2012 at 12:15 AM

I've been working on a Silverlight internal Sales Information site for about a year now and I've tried making File Download Proxy equivalent resources for it several times without success. Today I stumbled across your page and was like.. WOW, why didn't I see this before? The UI looks streamlined and exactly the kind of thing that I need.

However, after following the examples in Documentation, I was unable to successfully integrate the code. There are two separate issues (one with uploading and one with downloading). I'm afraid I can't seem to find the right combination of points to make this stuff work. For the moment, I just want the ability to push a file to a folder on my server as well as download a file from that server and save it to the user's system (My Documents or the IsolatedStorage, not sure which I want to do yet, doesn't really matter there). I wil worry about more advanced things like storing to a database, etc later.

Win7 communicating to a Win2k8R2 server with latest IIS updates. Note that in place of appname and fqdn I have my actual values.

Issue 1: Uploading Files

Followed the Quick Start example with the following exceptions:

  • In Button_Click I inserted the following line (It's a sub-app)
    udialog.UploadUri = "appname/fileupload.ashx";
    • I've also tried https://[fqdn]/appname/fileupload.ashx and fileupload.ashx
  • In UploadHandler.cs I set the FileStoreFolder variable to appname/Repository
    • Ive also tried Repository
  • In Web.config I set the path on the handler to https://[fqdn]/appname/FileUpload.ashx
    • I've also tried appname/FileUpload.ashx and FileUpload.ashx

When I run the site in dev, it sucessfully passes and pulls the selected file into my dev's folder. When I run the site live, I get the NotFound error.

Issue 2: Downloading Files

Followed the Download without showing a Dialog Async example with no exceptions. In dev, I get a file that is created with 0 bytes. In live, I get a NotFound error.

SideNote: Do you have a sample project with all of this showing working in a sub-app type environment to see if I can just diff files until I find the problem?

Jan 26, 2012 at 6:18 PM

Thanks for considering Interlink.

As far as your upload error, ensure you worker process has permissions to create folders/files. that is usually the case going from dev to prod.

For the download can you provide some more details? it may be file access permissions. Can you try navigating directly to file itself and see it that works?

Jan 26, 2012 at 6:49 PM

Before starting, I had my server admin (we're in the same lab) set Everyone to Full Control on that directory (C:\inetpub\wwwroot\appname\Repository\)so that there wouldn't be any permissions issues.

When I navigate to https://[fqdn]/appname/Repository/tempfile.pdf it does come up in internet explorer.

Jan 26, 2012 at 8:44 PM

Is your project a 'Web Site' or a 'Web App' ?

Jan 26, 2012 at 8:46 PM

Can you share the relevant portions of your prod web config?

Jan 26, 2012 at 10:03 PM

Web page that consists entirely of the silverlight app, installable to user's system as OOB mode for offline use (often in front of a customer and still needing information about products where there's no wireless connectivity).

Here is my XML file with the security parts removed. In addition to this, I'm using DevExpress for advanced Reporting and other controls and I communicate with a SQL database on the same server (in a different path).

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="system.serviceModel">
      <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
    </sectionGroup>
    <sectionGroup name="devExpress" type="System.Configuration.ConfigurationSectionGroup, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <section name="xpf.printing" type="DevExpress.Xpf.Printing.Service.ConfigSections.PrintingServiceSection, DevExpress.Xpf.Printing.v11.1.Service, Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
    </sectionGroup>
  </configSections>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="..\Web_messages.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
      <add initializeData="..\Web_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>
  <connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Server=fqdn\appname01;Database=web01;User ID=sa2;Password=p@ssw0rd" />
    <add name="ApplicationServices" connectionString="Server=fqdn\appname01;Database=aspnetdb;User ID=sa2;Password=p@ssw0rd" />
    <add name="web01Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=fqdn\appname01;initial catalog=web01;persist security info=True;user id=sa2;Password=p@ssw0rd;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="web01ConnectionString" connectionString="Data Source=fqdn\appname01;Initial Catalog=web01;Persist Security Info=True;User ID=sa2;Password=p@ssw0rd" providerName="System.Data.SqlClient" />
    <add name="xpf.printing" connectionString="XpoProvider=MSAccess;Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;data source=|DataDirectory|/ReportService.mdb;user id=Admin;password=;" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <httpModules>
      <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
    <httpHandlers>
      <add verb="GET,POST" path="https://fqdn/appname/FileUpload.ashx" type="HSS.Interlink.Web.FileUpload, HSS.Interlink.Web" />
      <add verb="GET,POST" path="https://fqdn/appname/FileDownload.ashx" type="HSS.Interlink.Web.FileDownloadAsync, HSS.Interlink.Web" />
    </httpHandlers>
    <globalization culture="auto" uiCulture="auto" />
    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>
    <roleManager enabled="true">
      <providers>
        <clear />
        <add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
        <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
      </providers>
    </roleManager>
    <profile>
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
      </providers>
      <properties>
        <add name="FriendlyName" />
      </properties>
    </profile>
    <pages>
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
    <!--<pages pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
           pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
           userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc"/>
      </controls>
    </pages>-->
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
    <handlers>
      <add name="FileDownload" verb="GET,POST" path=https://fqdn/appname/FileDownload.ashx type="HSS.Interlink.Web.FileDownloadAsync, HSS.Interlink.Web"/>
      <add name="FileUpload" verb="GET,POST" path=https://fqdn/appname/FileUpload.ashx type="HSS.Interlink.Web.FileUpload, HSS.Interlink.Web"/>
    </handlers>
  </system.webServer>
  <system.serviceModel>
    <diagnostics>
      <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxSizeOfMessageToLog="4194304" />
    </diagnostics>
    <behaviors>
      <endpointBehaviors>
        <behavior name="ReportServiceRestBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="ReportServiceBehavior">
          <serviceMetadata httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="ReportServiceBehavior" name="AppName.Silverlight.Web.ReportService1">
        <endpoint binding="basicHttpBinding" bindingConfiguration="ReportServiceBinding" contract="DevExpress.XtraReports.Service.IReportService" />
        <endpoint address="rest" behaviorConfiguration="ReportServiceRestBehavior" binding="webHttpBinding" bindingConfiguration="ReportServiceRestBinding" contract="DevExpress.Xpf.Printing.Service.IExportServiceRest" />
        <!--<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />-->
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="ReportServiceBinding" receiveTimeout="00:10:00" maxReceivedMessageSize="4294967296" transferMode="Streamed">
          <!--<security mode="None"/>-->
          <security mode="Transport">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding name="ReportServiceRestBinding" receiveTimeout="00:10:00" transferMode="Streamed">
          <!--<security mode="None"/>-->
          <security mode="Transport">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <client />
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.net>
    <mailSettings>
      <smtp>
        <network host="internalemailserver.com" port="25" />
      </smtp>
    </mailSettings>
  </system.net>
  <devExpress>
    <xpf.printing>
      <documentStore keepInterval="86400000" connectionStringName="xpf.printing" />
    </xpf.printing>
  </devExpress>
  <appSettings>
    <!-- This value must match the Full TypeName including the namespace of your UploadHandler -->
    <add key="UploadHandler" value="AppName.Silverlight.Web.UploadHandler, AppName.Silverlight.Web"/>
    <add key="DownloadHandler" value="AppName.Silverlight.Web.DownloadHandler, AppName.Silverlight.Web"/>
  </appSettings>
</configuration>
Jan 26, 2012 at 10:20 PM

Ok...

1. IIS: is your apppool running in integrated mode?
2. DEV: is your app (project) a 'Web Application' or a 'Web Site'?
3. APP: Are you running out of browser (OOB)?

Jan 27, 2012 at 11:16 PM

Just checking in to see if you are still having issues?

The questions I had previously are not directly related to Interlink but the configuration within IIS.

If you're app is a web app, you have to write your upload handler in separate dll because ASP.NET dynamically compiles and mangles the namespacing. And if you're running out of browser, then you have to specify an absolute URI on the client side back to your handler.

And if you're running in integrated mode, you don't need handlers in the system.web config section and IIS should actually fail to run if you do. If it's not in integrated mode then you don't need the system.webserver config section.

Also, we recommend to use relative pathing.

Feb 3, 2012 at 9:21 PM

Sorry I haven't been able to respond. I have been pulled into a SEV1 project that demands full attention. I will get some more info to you mid next week.