Using Visual Studio 2010, I deployed my ASP.NET project to a development server and changed the Web.Config to reflect the development server paths. Some of the code is working, but for paths like images and other files, it seems to be looking at the local path of my machine. I looked all around the code for a hint at where it's using my local path, but I replaced all of them and it's still not working.
The DLLs are all compiled in the correct place, everything is up to date, etc. No problems running the code locally, either. Is there a specific step to ensure the deployment that I'm missing?
Thanks.
Error:
`Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
FieldControl(String FieldType, String Argument, Field ParentField) in D:\Users\mydirectory\FieldControl.cs:132
<more of these>
you adjust your paths with relative path.
A path relative to the root of the site, determined according to the site root (not the application). Paths relative to the root of the site are useful if you keep application resources cross, such as images or client script files in a folder under the root of the website.
his example assumes that path Assemblies folder is located under the Web site root.
"/Assemblies/test.dll"
This type of an error is not saying that it is looking for that local path, thats just where the error is in the code, the compiler is showing you where the issue is: line 132 of that file. Check there and you should see what is triggering the NULL ref.
Solved. My Web.Config was read only so when I changed the path's on the development server it didn't save correctly. Went back in and changed the path's, then made it read only. Thanks for everyone's help.
Related
I created a blank Unity project, built it for UWP and added one line of code:
File.ReadAllText(#"C:\\Users\jtth\Desktop\cntrlRcrds-013.txt");
And I get back,
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.ni.dll
Additional information: Access to the path 'C:\Users\jtth\Desktop\cntrlRcrds-013.txt' is denied.
I have:
Checking Firewall
Made sure all folders/files in path weren't Read Only
Changed path to root C:\
Tried path into the Apps data folder
Ran Unity & VS as admin
Restarted my computer
What gives? Please advise.
NOTE: I am running this on 'Local Machine', not on the HoloLens. The HoloLens has a variety of access permission issues itself.
UWP is very sandboxed, you can't really access most folders or files through the application...
Try
File.ReadAllText(System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "cntrlRcrds-013.txt"));
And put the file in the location that Windows.Storage.ApplicationData.Current.LocalFolder.Path points to.
Hope this helps.
i'm stuck.
I upload my umbraco 7.1 site which i develop on visual studio 2012 thorough FTP to my server.
I created an Application Pool which work with .net framework 4.0.30319.
I start the site in the IIS and try to check it in the browser and i got this error:
Could not load file or assembly 'UrlRewritingNet.UrlRewriter' or one
of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load
file or assembly 'UrlRewritingNet.UrlRewriter' or one of its
dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'UrlRewritingNet.UrlRewriter' could not be
loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Please help me to understand what should i do.
thanks,
Ido.
Seems like your Visual studio has not uploaded all DLL's from the BIN directory.
I would try to check using a FTP client whether all DLL's (in the bin folder) are uploaded.
I've been pulling out my hair on this and I'm pretty much bald at this point.
Background:
Web Service works on my development machine no problem. Deployment to other machines results in the above error when called.
In code, I have a web reference to an authorize.net API. Within it is a method that returns a response of type "CreateCustomerProfileTransactionResponseType". The parameters that it requires are of type MerchantAuthenticationType, CustomerProfileType, and ValidationModeEnum.
Where everything blows up is on the method that is supposed to return the above CreateCustomerProfileTransactionResponseType. I get the error:
What baffles me is that this isn't thrown on my machine (even when mimicking a live environment - No Visual Studio involved) but thrown on any other machine. My machine is a Windows 7 machine. I get failures deploying to 2 separate Windows Server 2008 R2 boxes. I've tried reboots, turning off UAC, etc but to no avail. I've even went so far as to cast the parameter it's complaining about to the object type that it's expecting but the error remains the same. Coding wise, The project is set up as follows:
Application calls a Gateway webservice
Gateway webservice checks web.config entry for what DLL to load and it's location
Gateway itself loads .dll using LoadFrom
Loaded dll runs my method (in this case to capture a payment) which uses the web reference to an authorize.net API
Response is returned to Application that calls it
Any help would be greatly appreciated as I've exhausted all other help avenues.
Thanks,
Check the version of the assembly which contains the type 'x'. Maybe another version of it installed in GAC.
Also check this: Unable to cast object of type MyObject to type MyObject
I figured it out. I had the .dll that I was loading (using Reflection) both in a specified location AND the bin directory of where the web service was. Seems to be a big no no. Removing the .dll from the bin directory solved my issues.
I am using a windows service, In which I am having a reference of an assembly which is copy local= false. But I am trying to load it at runtime, which is though working fine when I am running it from visual studio, But when I try to install it, cmd gives this error:
An exception occurred while trying to find the installers in the D:\Official\Pro
jects\20131007_ImproveDN\build\debug\application
s\SubscriptionService\SubscriptionService.exe assembly.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the
requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for D:\Official\Projects\2
0131007_ImproveDN\build\debug\applications\SubscriptionService\SubscriptionServi
ce.exe.
An exception occurred during the Rollback phase of the System.Configuration.Inst
all.AssemblyInstaller installer.
System.InvalidOperationException: Unable to get installer types in the D:\Offici
al\Projects\\20131007_ImproveDN\build\debug\appli
cations\SubscriptionService\SubscriptionService.exe assembly.
The inner exception System.Reflection.ReflectionTypeLoadException was thrown wit
h the following error message: Unable to load one or more of the requested types
. Retrieve the LoaderExceptions property for more information..
An exception occurred during the Rollback phase of the installation. This except
ion will be ignored and the rollback will continue. However, the machine might n
ot fully revert to its initial state after the rollback is complete.
Also one thing to note here is that If I make copy local true of that .dll it makes installation fine. BUt I dont want to load it before installation so I want to do it at runtime.
Thanks in Advance.
Maybe you need to use another version of InstallUtil.exe:
c:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
c:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
c:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe
Try to use x64 version from Framework64 subfolder.
Also one thing to note here is that If I make copy local true of that .dll it makes installation fine. BUt I dont want to load it before installation so I want to do it at runtime.
That doesn't really matter, the assembly still needs to make it to the installation directory. If you set Copy Local to false, then you still need to distribute the assembly with the installation.
I had a similiar problem. I did the following that worked for me.
First, use FuseLog (Assembly Binding Viewer) to figure out where the binding is failing (Described Here
Once I began getting logs, I noticed this in my log was "Invalid assembly platform or ContentType in file (hr = 0x8007000b)."
My solution consisted of 3 projects. I went through the build properties of each project and noticed that one of them was targeted for "x86". I changed it to "Any CPU", recompiled and the problem was resolved.
What should i do when this error prompt my screen
In VS2008 Express Edition
C:\Users\ami\Desktop\MyAddressBookasd\MyAddressBook\UpdateTheRecord.aspx: ASP.NET runtime error: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
In Web Browser
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as Definition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Source Error:
Line 36: ASP.NET to identify an incoming user.
Line 37: -->
Line 38:
Line 39: section enables configuration
It seems you have not configured the virtual directory for your website as an application in IIS. If you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and may get the above error.
please visit this link to solve it.
allowDefinition='MachineToApplication' beyond application level" in asp.net
There can be one of many possible reasons for this
You may have added a backup folder inside the main folder. If yes, Remove it.
Make sure that you have opened the correct root folder, in case you are running the project with Visual Studio
Make sure that you don't have any copy of web.config files kept in the project.
Hopefully it helps.
In case you are still experiencing the same problem, let me know :)
Convert to application your virtual/pshysicial directory in IIS Web sites. When convert to appication, resolve your error.