For opening and saving Office files I integrated ITHit WebDav server to my solution. WebDav is implemented in a separate project but in the same solution. Local it works fine, I can open and save Word and Excel documents. But after deploying, when I try to open File, following error comes up:
Sorry, we couldn’t open the File “http://MyWebSite.de/Storage/test.xlsx”
Microsoft Excel cannot access the file “http://MyWebSite.de/Storage/test.xlsx”.
There are several possible reasons:
- The file name or path does not exist.
- The file being used by another program.
- The workbook you are trying to save has the same name as a currently open workbook.
File is on a right place and the application have full rights on it.
Local WebDav project have his own web.config. But after deploy there are only web.config from WebSite project and WebDav is a .dll file in Bin folder.
WebSite web.config severside and local:
...
<location path="Storage">
<system.web>
<httpHandlers>
<clear />
<add verb="*" path="*" type="WebDav.DavHandler, WebDav" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="My WebDAV Handler" path="*" verb="*" type="WebDav.DavHandler, WebDav" preCondition="integratedMode" />
</handlers>
</system.webServer>
</location>
...
WebDav web.config local:
...
<system.web>
<httpHandlers>
<clear/>
<add verb="*" path="*" type="WebDav.DavHandler, WebDav"/>
</httpHandlers>
<httpModules>
<remove name="FileAuthorization"/>
<add name="ITHitPutUploadProgressAndResumeModule" type="ITHit.WebDAV.Server.ResumableUpload.PutUploadProgressAndResumeModule, ITHit.WebDAV.Server"/>
<add name="ITHitPostUploadProgressModule" type="ITHit.WebDAV.Server.PostUploadProgressModule, ITHit.WebDAV.Server"/>
</httpModules>
<httpRuntime executionTimeout="2400" maxRequestLength="2097151" requestPathInvalidCharacters="" relaxedUrlToFileSystemMapping="true" targetFramework="4.5"/>
<customErrors mode="Off"/>
<authentication mode="None"/>
<authorization>
<allow users="*"/>
</authorization>
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
<compilation targetFramework="4.5" debug="true"/>
</system.web>
<system.webServer>
<handlers>
<clear/>
<add name="aspnet_isapi 32-bit ASP.NET 2.0" path="*" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32"/>
<add name="aspnet_isapi 64-bit ASP.NET 2.0" path="*" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness64"/>
<add name="aspnet_isapi 32-bit ASP.NET 4.0" path="*" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness32"/>
<add name="aspnet_isapi 64-bit ASP.NET 4.0" path="*" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness64"/>
<add name="My WebDAV Handler" path="*" verb="*" type="WebDav.DavHandler, WebDav" preCondition="integratedMode"/>
</handlers>
<modules>
<remove name="FileAuthorization"/>
<add name="ITHitPutUploadProgressAndResumeModule" type="ITHit.WebDAV.Server.ResumableUpload.PutUploadProgressAndResumeModule, ITHit.WebDAV.Server"/>
<add name="ITHitPostUploadProgressModule" type="ITHit.WebDAV.Server.PostUploadProgressModule, ITHit.WebDAV.Server"/>
<remove name="WebDAVModule"/>
</modules>
<validation validateIntegratedModeConfiguration="false"/>
<security>
<requestFiltering allowDoubleEscaping="true">
<fileExtensions>
<clear/>
</fileExtensions>
<hiddenSegments>
<clear/>
</hiddenSegments>
<requestLimits maxAllowedContentLength="2147483648"/>
</requestFiltering>
</security>
<staticContent>
<mimeMap fileExtension=".pkg" mimeType="application/octet-stream"/>
<mimeMap fileExtension=".deb" mimeType="application/octet-stream"/>
</staticContent>
</system.webServer>
...
How could i solve this Problem?
Related
I'm working with asp.net core 2.1, I launch the app on my local machine without any problem and I can debug it and open it on the browser but when I deploy it to the server I get the rediction error and I can't login.
Here is my web.config file :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false" />
</appSettings>
<location path="." inheritInChildApplications="false" allowOverride="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\BusinessAdvisor.Inventory.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
<system.web>
<trust level="Full" />
</system.web>
</location>
<system.web>
<authentication mode="None" />
<compilation defaultLanguage="c#" debug="true" />
</system.web>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;user id=????_dba;password=???????;database=atechdzc_mobiserv;allowuservariables=True;persistsecurityinfo=True;SslMode=none" />
</connectionStrings>
</configuration>
<!--ProjectGuid: 5d471955-9737-4896-a960-3eb7ede4494e-->
I tried all the solutions montioned but I get the same error !
EDIT :
When I make the authentification to "Windows authentication" the error doesn't appear and if I make it as "Anonymous authentication" the error still here.
It was an error on my connection string and then the migration didn't update changes automaticaly. I fixed my connection string on appsettings.production.json and I updated the database.
For me, my IIS App pool runs under a specific account. When I had to re-create the database, I had to grant permissions to that account to the database.
I am reading this blog and wondering will this new web.config file work on azure as it is. Thanks.
https://blogs.msdn.microsoft.com/webdev/2016/05/16/announcing-asp-net-core-rc2/
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%"
arguments="%LAUNCHER_ARGS%"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
Yes the new aspnet core configuration file will pickup the app settings as environment variables and work very similar to how they do now
I am implementing a RESTful web services host using ASP.Net 4.5 and Web Api 2 Attribute Routing. I also included Web Api Help Pages. When I run it locally through Visual Studio 2012 on IIS Express it works great and looks really cool; it displays the default /home/index page with an API menu that shows the documentation for all my RESTful API functions. I have also tested all the API methods with SOAPUI and running locally everything works perfectly.
But the URL routing absolutely refuses to work when deployed to IIS 7.5 on Windows 2008 Server R2.
When I browse the site I get:
403 - Forbidden: Access is denied.
If I try the /home/index or any of the routes of my web api methods I get:
404 - File or directory not found.
I have installed .Net 4.5 on the server and then went to Windows\Microsoft.NET\Framework64 and ran:
Aspnet_regiis -i
iisreset
I deployed my app to IIS and set the Application Pool to use .Net Framework v4.0.30319 and Managed pipeline mode: Integrated.
I have the following settings in my web.config:
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="None" />
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
I have tried many different variations on the web.config entries. For example, the suggestion in this post does not work either:
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
<!-- any other modules you want to run in MVC e.g. FormsAuthentication, Roles etc. -->
</modules>
Nor does changing the Handlers section like this have any effect:
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<remove name="WebDAV" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
I did try turning directory browsing on and then it showed the website contents just fine, so the 403 Forbidden error is because directory browsing was forbidden.
But I don't want to browse the contents, I want URL routing to work. In RouteConfig.cs file I have a default route:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
So if URL routing were working then it should show the Home/Index view by default.
I also tried adding an Index.html file to the site and that worked fine too. So the website works fine as a website, but URL routing refuses to work.
Try to add this attribute to < modules > tag in web.config
runAllManagedModulesForAllRequests="true"
I have a web application running in .net framework 2.0 and hosted on IIS 7.5. The app pool is running in classic mode. I want to intercept all the requests containing .txt files. Below is my entry in web.config
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="NES.HiLo.Security.CommunityResource, NES.HiLo.Security" verb="*" path="*.txt" type="NES.HiLo.Security.CommunityResource, NES.HiLo.Security" />
</handlers>
</system.webServer>
<httpHandlers>
<add verb="*" path="*.txt" type="NES.HiLo.Security.CommunityResource, NES.HiLo.Security" />
</httpHandlers>
When I m making requests for URL like
http://local.mysite.com/media/CLT/ResourceUploads/1000277/Test1.txt
the handler never kicks in, the control never comes inside the code in the handler.
Any ideas what I m missing? thanks
According to the MSDN example of registering handler in IIS 7.0 in classic mode, you are missing a couple of attributes:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="CommunityResourceHandler" verb="*" path="*.txt"
type="NES.HiLo.Security.CommunityResource, NES.HiLo.Security"
modules="IsapiModule"
scriptProcessor="FrameworkPath\aspnet_isapi.dll"
resourceType="File" />
</handlers>
</system.webServer>
<httpHandlers>
<add verb="*" path="*.txt" type="NES.HiLo.Security.CommunityResource, NES.HiLo.Security" />
</httpHandlers>
I am developing an ASP.NET MVC applications with MS Visual Studio 2008 SP1.
My project structure is the default one:
Project |-Content |-css |-img |-Models |-Views
|-Controllers
The thing is, I am able to access all the content placed under Content directory provided the file is included in the project. On the other hand, if I happen to have an image (I.E. an image uploaded by the user) that's on the right physical directory (Project\Content\img) but is not included in the project, I keep getting a 404 error when I access them with a browser.
I think my URL is correct:
http://localhost:1260/Content/img/my_image.jpg
And I do have a file under Project\Content\img\my_image.jpg.
What can be wrong? Am I forced to include all the files on the project? I don't think so, because that would mean that I can't have images uploaded and saved by the web users this way.
Thanks a lot.
If you're hosting your project with IIS 7, you must add he content-type in IIS 7(Handler Mapping). But if you're hosting your project with the Asp.net Developer Server, it's not required.
Using the following code in web.config file
<configuration>
<system.webServer>
<handlers>
<add name="css mapping" path="*.css" verb="*" type="System.Web.StaticFileHandler" resourceType="Unspecified" preCondition="integratedMode" />
<add name="js mapping" path="*.js" verb="*" type="System.Web.StaticFileHandler" resourceType="Unspecified" preCondition="integratedMode" />
<add name="gif mapping" path="*.gif" verb="*" type="System.Web.StaticFileHandler" resourceType="Unspecified" preCondition="integratedMode" />
<add name="jpg mapping" path="*.jpg" verb="*" type="System.Web.StaticFileHandler" resourceType="Unspecified" preCondition="integratedMode" />
<add name="png mapping" path="*.png" verb="*" type="System.Web.StaticFileHandler" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>